[英]How could I do a navigation bar that fill the screen?
I am beginner.
我是初学者。 I want to make a similar bar to this, but I do not succeed to make the bar fill all the screen and I have no idea how I could make the text to be aligned as in the picture.
我想为此制作一个类似的条,但是我没有成功使条充满整个屏幕,而且我不知道如何使文本与图片对齐。
To put that logo in the middle of the div I used this id. 为了将该徽标放在div的中间,我使用了此ID。
#clogo {
height: 50px;
margin: auto;
display: block;
}
You could use display: flex
to center items and width: 100%
to make the navbar full width like so: 您可以使用
display: flex
居中项和width: 100%
使导航栏变为全宽,如下所示:
HTML: HTML:
<nav>
<ul>
<li>link1</li>
<li>link2</li>
<li>link3</li>
<li>link4</li>
<li>link5</li>
</ul>
</nav>
CSS: CSS:
nav {
width: 100%;
background-color: #ccc;
display: flex;
justify-content: center;
height: 50px;
}
nav ul {
list-style-type: none;
}
nav ul li {
display: inline;
font-size: 20px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.