html - Extra padding in CSS-based navigation -
i'm having issues css based navigation came with. reason there's small amount of padding (3px or so) between each navigation item, right of vertical line. also, in firefox white :hover offset making looked more tabbed navigation when mouse on it. here's jsfiddle:
https://jsfiddle.net/9m24tf4a/7/
on side note, there simple way have vertical lines take 90% of height instead?
html:
<div id="header_nav"> <ul> <li><a href="#" class="first">home</a></li> <li><a href="#">link 2</a></li> <li><a href="#">link 3</a></li> <li><a href="#">link 4</a></li> <li><a href="#">link 5</a></li> <li><a href="#">link 6</a></li> </ul> </div>
css:
#header_nav { margin: 0px; padding: 0px; clear: both; height: 36px; background-color: #ccc; border-top: 1px solid #b6b2a9; border-bottom: 1px solid #b6b2a9; } #header_nav ul { width: 1000px; padding: 0px; line-height: 36px; margin: 0px 100px 0px 100px; } #header_nav ul li { list-style-type: none; display: inline-block; font: 14px/36px 'arial', sans-serif; color: #555559; height: 36px; line-height: 36px; padding: 0px; margin: 0px; width: auto; border-right: 1px solid #b6b2a9; } #header_nav ul li:hover { background-color: #fff; width: auto; } #header_nav ul li { font: 14px/36px 'arial', sans-serif; color: #555559; text-decoration: none; line-height: 36px; margin: 0 17px; padding: 0px; } #header_nav ul li.first { /* border-left: 1px solid #b6b2a9; */ /* margin-left: 0px; */ }
there's known padding generated li elements displayed inline. either work float: left, either set font-size: 0 ul element, come , set desired font-size li element itself.
here's snippet font-size: 0; ul element.
#header_nav { margin: 0px; padding: 0px; clear: both; height: 36px; background-color: #ccc; border-top: 1px solid #b6b2a9; border-bottom: 1px solid #b6b2a9; } #header_nav ul { width: 1000px; padding: 0px; line-height: 36px; margin: 0px 100px 0px 100px; font-size: 0; } #header_nav ul li { list-style-type: none; display: inline-block; font: 14px/36px 'arial', sans-serif; color: #555559; height: 36px; line-height: 36px; padding: 0px; margin: 0px; width: auto; border-right: 1px solid #b6b2a9; font-size: 16px; } #header_nav ul li:hover { background-color: #fff; width: auto; } #header_nav ul li { font: 14px/36px 'arial', sans-serif; color: #555559; text-decoration: none; line-height: 36px; margin: 0 17px; padding: 0px; } #header_nav ul li.first { /* border-left: 1px solid #b6b2a9; */ /* margin-left: 0px; */ }
<div id="header_nav"> <ul> <li><a href="#" class="first">home</a></li> <li><a href="#">link 2</a></li> <li><a href="#">link 3</a></li> <li><a href="#">link 4</a></li> <li><a href="#">link 5</a></li> <li><a href="#">link 6</a></li> </ul> </div>
Comments
Post a Comment