I have the following dynamic markup:
#navigation li {
margin-bottom: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
<ul id="navigation">
<li><a href="javascript:void(0);" class="selected">Start page</a></li>
<li><a href="javascript:void(0);" style="display: none;">Logic</a></li>
<li><a href="javascript:void(0);">Your name</a></li>
<li><a href="javascript:void(0);" style="display: none;">Caller</a></li>
</ul>
Where list items need to be hidden the application injects style="display: none;"
into the anchor tag which leaves a blank space due to the padding on the parent li element. When there is a large list and multiple hidden links the spacing between the list items gets messed up.
Is there a way in css to check if anchor has style="display: none;"
and define the css to remove the padding top and bottom from the parent li
?
Any way to achieve this without jquery in css?