<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem 。这将有助于其他人回答问题。
关闭 5 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem 。这将有助于其他人回答问题。
关闭 5 年前。
我只想让我的菜单在我的标题中居中。
我的网站:http://test.projekt-tenis.pl/wordpress/
我的标题现在看起来像: 我只想将我的菜单居中,它太左了。我如何仅使用 wp-admin 和 custom.css 将其居中。 我尝试使用谷歌编辑: 但一直找不到解决方案,我将所有菜单移到左侧,而不是将其居中。任何人都可以帮忙吗?我只想将社交图标右对齐,但不知道为什么我在它们之间有这么多空间,像这样:
编辑 1 我添加了你写的内容,但它看起来像一样检查它: 我只想删除 facebook 图标和链接图标之间的空间,就像在 twitter 旁边和链接中一样。 正如我所说,当您打开我的网站时,我需要将我的菜单居中,您会看到主菜单:Główna、Oferta 等。不在中心,它的小 paddig 做左边我想使用 custom.css 将它居中
最佳答案
HTML 没有正确编写,因此没有正确的方法(我知道)通过使用正确的 CSS 来居中导航。但是,导航可以通过调整边距/填充来居中,但不推荐
因此,您将需要对 HTML 代码进行更改:(推荐)
如何:
div
float: left;
text-align: center;
到 Navigation示例:
#container{
width: 100%;
}
#container div{
float: left;
}
#logo, #social{
width: 15%;
}
#nav{
width: 70%;
text-align: center;
}
<div id="container">
<div id="logo">
LOGO
</div>
<div id="nav">
NAVIGATION ITEMS
</div>
<div id="social">
SOCIAL
</div>
</div>
并且社交媒体图标之一应用了额外的填充,您可以通过两种不同的方式修复:
1. 找到下面的一段代码,把padding-right: 10px
改成padding-right: 0px
旧:(目前,看起来像这样)
.primary-menu li:nth-last-child(-n+3) {
float: right;
padding-right: 10px;
}
新:(应该看起来像)
.primary-menu li:nth-last-child(-n+3) {
float: right;
padding-right: 0px;
}
2.在custom.css
或其他样式文件中添加如下代码。
.primary-menu li:nth-last-child(-n+3) {
padding-right: 0px;
}
注意:
关于css - 在 wordpress 中使用 custom.css 对齐标题中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45621324/