【发布时间】:2023-02-03 13:01:06
【问题描述】:
我正在尝试制作一个简单的顶部栏
作为一种将我一直在学习的东西付诸实践的方式我并不是在寻找解决方法尽管我希望了解正在发生的事情并修复它,以便我可以应用我最近学到的知识。 (对不起,如果这会显得粗鲁)
从视觉上看应该是这样的:
||______________________centered-title___________button1__button2||
但我无法正确居中标题。 将内联块添加到居中标题后,我无法将其从左侧移动,因为文本对齐停止对其产生影响
这是我的代码
网页格式
</head>
<body>
<header class="contenedor">
<div class="logo">
<p><a href="index.php">PAGE TITLE</a></p>
</div>
<div class="derecha">
<nav class="contacto">
<ul>
<li><a href="#">SOCIALS 1</a></li>
<li><a href="#">SOCIALS 2</a></li>
</ul>
</nav>
</div>
</header>
</body>
</html>
CSS
* {
margin: 0;
}
body {
background: rgb(15, 17, 26);
}
.logo {
text-align: center;
display: inline-block;
font-family: "Oswald";
line-height: 70px;
}
header {
background: gray ;
}
.contenedor {
overflow: hidden;
}
.derecha {
float: right;
}
header .contacto {
display: inline-block;
}
header .contacto ul {
list-style: none;
}
header .contacto ul li {
display: inline-block;
line-height: 70px;
}
【问题讨论】: