3
Colleagues.
I have a Bootstrap menu that I’d like to place the Font Awesome icons next to each item in that menu. HTML looks like this:
<ul class="dropdown-menu">
<li><a href="#">Todos os nomes</a></li>
<li><a href="#">Nome A</a></li>
<li><a href="#">Nome B</a></li>
<li><a href="#">Nome C</a></li>
<li><a href="#">Nome D</a></li>
<li><a href="#">Nome E</a></li>
</ul>
The CSS of dropdown-menu is like this:
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, .15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
}
While accessing the official Font Awesome website, I found a native class of them fa-ul and the fa-li, so I put it this way:
<ul class="dropdown-menu fa-ul">
<li><a href="#">Todos os nomes</a></li>
<li><a href="#"><i class="fa-li fa fa-check-square"></i> Nome A</a></li>
<li><a href="#">Nome B</a></li>
<li><a href="#">Nome C</a></li>
<li><a href="#">Nome D</a></li>
<li><a href="#">Nome E</a></li>
</ul>
The icon appeared, but burst on our left side. See next to the Name A:
How I would fix?
places the
li
's inposition:relative;
thei
's withinli
's asabsolute
, and position them as you wish ;)– Murilo Melo
Hello Murilo. Forgive me ignorance, but I could not understand it properly. Could you show me an example?
– user24136
ul li {position:relative;}
and,li i{position:absolute;}
, it is not ignorance any man ;D if n works and you can share the full code, by team Viewer I may be helping– Murilo Melo
Thanks Murilo. It worked.
– user24136
puts your answer and within 2 days already as the right ;)
– Murilo Melo
Murilo, be sure to post as an answer, otherwise the page is "lame"... as already answered in the comments, no one will put answer to a problem you solved, and then ends up being 'answered' but no answer...
– gustavox