Previous Message
Next Message

Re: [css-d] border issues

Sent by Eric A. Meyer on 5 September 2002 18:06


At 13:19 -0400 9/5/02, RUST Randal wrote:

>I'm trying to help a newbie out with his CSS, but he's stumped me with
>something.  He wants to apply a border to a P element, and this is his
>original rule:
>
>p.box {
>	border-width: 0px 0px 2px 0px;
>	border: #616161 solid; }
>
>In IE 6, you get a 2px border on the bottom.  In N7 and Mozilla, you get
>roughly a four-pixel border all the way around the element.

    Actually it's a 'medium' border.

>I actually think that IE is getting this right, and that N7 and M somehow
>think that a border-style of "solid" equates to 4 pixels.

    It's the other way around, more or less.  Here's how Gecko 
interprets those declarations, as per CSS:

p.box {
	border-width: 0px 0px 2px 0px;
	border: #616161 solid medium; }

It's filled in the default value for 'border-width', which is 
supposed to happen with shorthand properties.  So the 'medium' 
overrides the previous 'border-width' declaration.  Reversing the 
order of those two declarations should get the result he wants in 
Gecko as well as IE.
    Similarly:

p {font-weight: bold; font-style: italic; font: 12px sans-serif;}

...will get you unbolded, non-italic 12-pixel sans-serif text in any 
CSS1 (or later) conformant browser.

--
Eric A. Meyer (http://www.meyerweb.com/eric/), List Chaperone
"CSS is much too interesting and elegant to be not taken seriously."
   -- Martina Kosloff (http://www.mako4css.com/)
Previous Message
Next Message

Message thread: