(我尝试禁用媒体查询,同样的事情)
html代码
<div id="navbox">
<nav>
<ul>
<li><a href="#1">Usluge</a></li>
<li><a href="#2">Cvijeće</a></li>
<li><a href="#3">Galerija</a></li>
<li><a href="#4">O nama</a></li>
<li><a href="#5">Kontakt</a></li>
</ul>
</nav>
</div>
css代码
#navbox {
width: 620px;
float: left;
font-size: 14px;
font-family: 'Open Sans', sans-serif;
}
#navbox nav {
width: 620px;
float: left;
margin-top: 66px;
}
#navbox li {
width: 68px;
float: right;
list-style: none;
margin-left: 24px;
background: rgb(230,230,230);
}
#navbox a {
display: block;
padding: 134px 0px 0px 0px;
border: 0px solid rgb(195,195,195);
color: rgb(171,74,119);
text-decoration: none;
text-align: center;
}
答案 0 :(得分:0)
在CSS中试试这个:
#navbox nav {
width: 620px;
float: left;
margin-top: 66px;
}
#navbox li {
float: right;
list-style: none;
margin-left: 24px;
background: rgb(230,230,230);
}
#navbox a {
display: block;
padding: 15px 20px; //adjust to your liking
border: 0px solid rgb(195,195,195);
color: rgb(171,74,119);
text-decoration: none;
text-align: center;
}
@media screen and (max-width:767px){
#navbox nav {
width:100%;
}
}
如果它不适合您,您可以发布指向您网页的链接,以便我们查看吗?