我的菜单有问题。当我更改浏览器窗口大小时,我的菜单从水平变为垂直。是否有任何选项可以在窗口中使文本变为静态?即使我改变窗口大小,我也希望我的菜单保持相同的状态。这里是我的代码:CSS最小化窗口更改外观
nav {
position: absolute;
margin-top: 288px;
margin-left: 378px;
height: 25px;
z-index: 2;
}
nav>ul>li {
font-size: 20px;
color: white;
padding: 10px 40px;
display: inline-block;
z-index: 2;
}
nav>ul>li>a {
text-decoration: none;
color: rgba(0, 0, 0, 0.35);
transition: all linear 0.15s;
}
nav>ul>.current-item>a {
background-color: rgba(0, 0, 0, 0.35);
text-align: center;
color: white;
padding: 3px 22px;
border-radius: 10px;
border: none;
cursor: pointer;
width: 50px;
height: 28px;
z-index: 2;
text-decoration: none;
}
nav>ul>li:hover>a {
background-color: rgba(0, 0, 0, 0.35);
text-align: center;
color: white;
padding: 3px 22px;
border-radius: 10px;
border: none;
cursor: pointer;
width: 50px;
height: 28px;
z-index: 2;
}
<nav>
<ul>
<li class="current-item"><a href="index.php"> HOME </a></li>
<li><a href="profile.php">PROFILE</a></li>
<li><a href="contact.php">CONTACT</a></li>
</ul>
</nav>
你能添加html标记吗? – Kathara
从你的'nav'标签中删除'margin',它限制了导致''li'包装的'ul'的宽度。 – APAD1
不起作用...同样的问题 – StringDot