私のメニューに問題があります。ブラウザのウィンドウサイズを変更すると、メニューが水平から垂直に変化します。ウィンドウ内にテキストを静的にするオプションはありますか?私はウィンドウのサイズを変更してもメニューが同じ状態を維持したい。ここに私のコードは次のとおりです。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-markupも追加できますか? – Kathara
あなたの 'nav'タグから' margin'を取り除くと 'li'のラップを引き起こしている' ul'の幅が制限されています。 – APAD1
は動作しません...同じ問題 – StringDot