I am building an AngularJS app. I am having the following difficulties styling the page. Here is a fiddle: https://jsfiddle.net/9ooa3wvf/
1) On hover I want to change the color of the nested li
elements (Class name is nested
). I have tried several different approaches, but nothing seems to work.
2) I want to vertically align the nested li
elements in the center
with the links About
and Services
. They are being aligned like so:
I want them to be aligned like so:
In the above picture, Our Team
is not on the same line as About
.
HTML
<div ng-show = "buttonDisplay" id = "buttonDisplayContent" class = "cssFade" >
<ul>
<li class = "normal"><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 class = "normal"><a href = "#"> Contact </a></li>
</ul>
</div>
CSS
#buttonDisplayContent ul {
list-style-type:none;
padding:0px
}
#buttonDisplayContent ul ul {
list-style-type:none;
padding:0px
}
#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
}
#buttonDisplayContent li {
margin-bottom:0.1%
}
.subLi{
margin:0px;
padding:0px;
list-style-type:none
}
.nested {
margin-left:0px;
display:inline
}
.nested li {
display:inline;
padding-bottom:6px;
padding-right:1%;
padding-left:1%;padding-top:8px
}
#buttonDisplayContent ul li:hover {
background-color:black
}
UPDATE
The following code solved the problem. I added a span
on the li
elements I wanted to vertically align.
<div ng-show = "buttonDisplay" id = "buttonDisplayContent" class = "cssFade" >
<ul>
<li class = "normal"><a href = "#"> Home </a></li>
<li class = "subLi"><a href = "#">About </a>
<span>
<ul class = "nested">
<li> <a href = "#"> Our Team </a> </li>
<li> <a href = "#"> Our efforts </a> </li>
</ul>
</span>
</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 class = "normal"><a href = "#"> Contact </a></li>
</ul>
</div>
CSS:
#buttonDisplayContent ul {
list-style-type:none;
padding:0px
}
#buttonDisplayContent ul ul {
list-style-type:none;
padding:0px
}
#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
}
#buttonDisplayContent li {
margin-bottom:0.1%
}
span .nested li {
display:inline-block
vertical-align:middle
}
.subLi{
margin:0px;
padding:0px;
list-style-type:none
}
.nested {
margin-left:0px;
display:inline
}
.nested li {
display:inline;
padding-bottom:6px;
padding-right:1%;
padding-left:1%;padding-top:8px
}
#buttonDisplayContent ul li:hover {
background-color:black
}