The code below is taken from a tutorial book. The thing I cannot figure out is that when I get rid of the code “border-bottom: none” in ‘ul a’ the menu boxes get smaller in vertical direction. Can someone please tell me why this happening?
Hi, the problem is that borders (vertical borders anyway, top and bottom) add to the total height of the anchor (it was set on the anchor)
So lets say the anchor (theoretical) has a height of 30px
2px vertical borders altogether make it 32px height. If you specify border-bottom:none; then you make the height 31px and thus shrinking it.
As you have already seen, this is a horizontal menu and in fact it gets shrung much much more than 1px. You can try it by copying the code into your text editor, do what I did and see the results. Or am I still missing something?
Sorry it was my fault. What I actually did was, I deleted only ‘none’ and left the rest of the text left to it. So the menus got shrunk in a very weird way. However, when I deleted the code completely, as you have told me, it got shrung only by 1 px. It is all solved now. Thanks for your hand…
Just so you know, if you deleted hte word none (and the semi colon) it would basically have hte property be this
border-bottom:
padding: 5px;
Which is invalid so BOTH would be stricken. So that’s 10px vertical padding gone which is probably waht you were seeing :).
Edit:
And Blake no, it can be either. Border:0; will stop an IE6 bug on an element…but completely irrelevant in this case since that element isn’t even IN the code above… Either or will work just perfectly
I’m not seeing that effect. When i remove the border-bottom:none, the 1px dashed border bottom you have on the ul appears more pronounced and gives the anchor a 1 px more height. Removing the border on the ul and the border:none on the anchor gives no difference in vertical height. So i’m not sure what you’re seeing on your end…
Well both are correct as the “none” will refer to border-style and if border-style is none then no border should be drawn according to the specs (no matter what the border width is).
However there are some bugs in older browsers so border:0 (or border:0 none) is actually safer anyway