I am working on a menu that needs to stay centered at the top of the screen, with a consistent appearance and just one line, regardless of the screen width. However, I'm encountering an issue where the menu mysteriously transitions into a two-line format at a certain width.
Any suggestions on how to resolve this problem with the two-line menu?
Try resizing the screen in the JSFiddle link provided above for better insight into the issue.
HTML:
<ul id="menu">
<li><a href="#" class="menu-items1">ABOUT US</a></li>
<li><a href="#" class="menu-items1">SERVICES</a></li>
<li><a href="#" class="menu-items1">CLIENTS</a></li>
<li><a href="#" class="menu-items1">ADDRESS</a></li>
</ul>
CSS:
ul {
list-style-type:none;
margin:0;
padding:0;
position: absolute;
margin-left:29%;
margin-right:29vw;
}
li {
display:inline-block;
float: left;
margin-right: 1px;
}
li a {
font-family: "Open Sans", sans-serif;
font-size: 11px;
letter-spacing:2px;
display:block;
height: 50px;
text-align: center;
line-height: 50px;
color: #000;
}
.menu-items1 {
min-width:90px;
margin-top:1.5px;
}
.menu-items2-1 {
margin-left:20px;
}
.menu-items2-2 {
margin-left:20px;
margin-top:0.5px;
}
.menu-items2-3 {
margin-left:10px;
}
.menu-items2-4 {
margin-left:30px;
margin-top:0.5px;
}
li:hover a {
text-decoration:none;
color: rgba(153, 153, 153, 1);
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
cursor: pointer;
}
li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}