I have this annoying problem with padding. I am building a menu, here is the html code for it (I have taken out all the other tabs and leave only one for better readability):
<div id="menu">
<a class="<?php echo $description; ?>" href="<?php echo $path; ?>">Opis</a>
</div>
$description can take two values:
- selected
- notSelected
And the $path is just for correct relative addressing.
Here is the CSS code:
#menu {
font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
background-color: #1958b7;
padding: 0 0 20px 0; /*Here set the size for tabs.*/
border-top: 10px #2175bc solid; /*Here we add border.*/
}
#menu a {
color: #fff; /*White color. */
text-decoration: none; /*No decoration.*/
padding: 0px 9px 5px 9px; /*The padding for tab.*/
}
.selected {
border-left: 8px solid #5ba3e0; /*Defining color and width for left border.*/
border-right: 8px solid #5ba3e0; /*Defining color and width for right border.*/
background-color: #2586d7;
}
.notSelected {
border-left: 8px solid #1958b7;
border-right: 8px solid #1958b7;
background-color: #2175bc;
}
Now the problem is with padding from #menu a:
padding: 0px 9px 5px 9px; /*The padding for tab.*/
In Opera, Chrome, IE7, IE8 and IE9 it works properly, the result is this:
But in Firefox 4.0.1 (and I remember this was also a problem with FF 3.6) it displays like this:
As you can see, the FF puts 1px above tag Opis for no reason, even though I have defined explicitly not to put any padding on top. So now that 1px of strong blue color is visible on top of tab.