1
I was modifying my fixed bar on my site, and something occurred to me that I can’t fix: I have 1 nav
that inside is 1 ul
that inside is 4 li
s and within each li
has a a
, what happens is that I am leaving the following property to the li
s to occupy 25% of the size of nav
(or of ul
, I’m not sure, but it’s irrelevant since both have the same size and their padding
s = 0), but when the rule is applied the last item on the list does not fit on the same line and jumps to another, which I don’t want to happen.
Here is the relevant code:
<nav id="menu">
<ul>
<li class="active"><a href="index.html">HOME</a></li>
<li><a href="servicos.html">SERVIÇOS</a></li>
<li><a href="fotos.html">FOTOS</a></li>
<li><a href="contato.html">CONTATO</a></li>
</ul>
</nav>
/*CSS em arquivo separado*/
* {box-sizing:border-box;}
nav#menu {
position : fixed;
top : 0;
width : 320px;
left : 0;
z-index : 10;
}
nav#menu ul {
padding : 0;
z-index : 10;
background-color: #DCDCDC;
list-style : none;
margin : 0;
left : 0;
right : 0;
}
nav#menu ul li {
background-color:#DCDCDC;
display : inline-block;
width: 25%;
padding : 4px;
font-family : 'Titillium Web';
font-size : 10pt;
text-align : center;
}
nav#menu ul li.active {
background-color: #ffffff;
border-bottom : solid 2px rgb(200,20,20);
background-image: none;
color : rgb(200,20,20);
}
nav#menu ul li a {
text-decoration: none;
color : #393939;
word-spacing : 0;
}
What I realized is that if you click and drag your mouse as if you were selecting a text in addition to selecting the content within the a
white spaces are also selected between the li
s.
Try adding "Nav#menu ul li" to the "float: left;" property. If not, put the size in pixels to see how they behave. It is also worth putting "padding: 0px;" in the "Nav#menu"
– Rodrigo Tognin