-

2011年8月3日星期三

How to make a border in HTML that does not add to the width of the element?

-For example, if I made a "container" "menu" and "content" div and wanted the menu to be vertically aligned instead of horizontal how could I say #menu {width:20%;border:1px solid;} but in the end have the total width be 20% instead of 20% + 1px? Answers in HTML or CSS should be fine.Can't be done. The border will always be added to the width and there is nothing you can do about it. You need to study the HTML box model. Google on those three words and you will get lots of explanations.

没有评论:

发表评论