I am able to display all the nested li's
inline. What I don't understand is why there is a gap between About
and Our Team
li
elements. I have already tried setting the margin
and padding
of both ul
and li
elements to 0
.
<div ng-show = "buttonDisplay" id = "buttonDisplayContent">
<ul>
<li><a href = "#"> Home </a></li>
<li class = "subLi"><a href = "#"> About </a></li>
<ul class = "nested">
<li> <a href = "#"> Our Team </a> </li>
<li> <a href = "#"> Our efforts </a> </li>
</ul>
<li class = "nextToNested"><a href = "#"> Blog </a></li>
<li class = "subLi"><a href = "#"> Services </a></li>
<ul class = "nested">
<li> <a href = "#"> Design </a> </li>
<li> <a href = "#"> Web </a> </li>
<li> <a href = "#"> Learn </a> </li>
<li> <a href = "#"> Invent </a> </li>
</ul>
<li class = "nextToNested"><a href = "#"> Portfolio </a></li>
<li><a href = "#"> Contact </a></li>
</ul>
</div>
CSS
#buttonDisplayContent ul {
list-style-type: none;
padding: 0;
}
#buttonDisplayContent ul ul {
list-style-type: none;
padding: 0;
}
#buttonDisplayContent ul a {
text-decoration: none;
color: #000;
font-size: 25px;
font-weight: bold;
}
#buttonDisplayContent ul ul a {
text-decoration: none;
color: lightgray;
font-size: 15px;
font-weight: bold;
}
.subLi {
float: left;
margin: 0;
padding: 0;
list-style-type: none;
}
.nested {
margin-left: 0;
}
.nested li {
display: inline-block;
padding-bottom: 6px;
padding-right: 1%;
padding-left: 1%;
padding-top: 8px;
}
#buttonDisplayContent ul li:hover {
background-color: black;
}
UPDATE
Thanks for all your help. I changed my HTML
and CSS
as follows. Li
elements are still not aligning as desired. Here is a fiddle: https://jsfiddle.net/qvq87ke1/2/
HTML
<div ng-show = "buttonDisplay" id = "buttonDisplayContent" >
<ul>
<li><a href = "#"> Home </a></li>
<li class = "subLi"><a href = "#">About </a>
<ul class = "nested">
<li> <a href = "#"> Our Team </a> </li>
<li> <a href = "#"> Our efforts </a> </li>
</ul>
</li>
<li class = "nextToNested"><a href = "#"> Blog </a></li>
<li class = "subLi"><a href = "#"> Services </a>
<ul class = "nested">
<li> <a href = "#"> Design </a> </li>
<li> <a href = "#"> Web </a> </li>
<li> <a href = "#"> Learn </a> </li>
<li> <a href = "#"> Invent </a> </li>
</ul>
</li>
<li class = "nextToNested"><a href = "#"> Portfolio </a></li>
<li><a href = "#"> Contact </a></li>
</ul>
</div>
CSS
#buttonDisplayContent {
background-color: #141516;
width: 100%;
margin-top: 9%;
text-align: center;
position: absolute;
opacity: 0.9;
}
#buttonDisplayContent ul {
list-style-type: none;
padding: 0;
}
#buttonDisplayContent ul ul {
list-style-type: none;
padding: 0;
}
#buttonDisplayContent ul a {
text-decoration: none;
color: #fff;
font-size: 50px;
font-weight: bold;
}
#buttonDisplayContent ul ul a {
text-decoration: none;
color: lightgray;
font-size: 40px;
font-weight: bold;
}
.subLi {
float: left;
margin: 0;
padding: 0;
list-style-type: none;
}
.nested {
float: right;
margin-left: 0;
}
.nested li {
display: inline-block;
padding-bottom: 6px;
padding-right: 1%;
padding-left: 1%;
padding-top: 8px;
}
#buttonDisplayContent ul li:hover {
background-color: black;
}