Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





  Last Thread  Next Thread
Author
Thread Post New Thread   

Eric Meyer on CSS question
 

Jamie




quote this post edit post

IP Loged report this post

Old Post  07-24-04 - 12:17 AM  
Hi,

This line is straight from page 82 of "Eric Meyer on CSS":

td#main {background: #FFD; color: black; border: 2px solid #797;
border-width: 2px 2px 2px 1px; }

Isn't it redundant to have "2px" in the border rule when you have an
explicit border-width rule? What am I missing?


Jamie


Post Follow-Up to this message ]
Re: Eric Meyer on CSS question
 

Alan J. Flavell




quote this post edit post

IP Loged report this post

Old Post  07-24-04 - 12:17 AM  
On Fri, 23 Jul 2004, Jamie wrote:

> td#main {background: #FFD; color: black; border: 2px solid #797;
> border-width: 2px 2px 2px 1px; }
>
> Isn't it redundant to have "2px" in the border rule when you have an
> explicit border-width rule? What am I missing?

The shortcomings of some earlier browser versions, I think.

In other contexts it might be an issue of specificity, but I can't see
how that would be operative here.


Post Follow-Up to this message ]
Re: Eric Meyer on CSS question
 

C A Upsdell




quote this post edit post

IP Loged report this post

Old Post  07-24-04 - 12:17 AM  
"Jamie" <enzymatic2009@yahoo.com> wrote in message
news:88adnYV1DMlVGJzcRVn-iQ@broadviewnet.net...
> Hi,
>
> This line is straight from page 82 of "Eric Meyer on CSS":
>
> td#main {background: #FFD; color: black; border: 2px solid #797;
> border-width: 2px 2px 2px 1px; }
>
> Isn't it redundant to have "2px" in the border rule when you have an
> explicit border-width rule? What am I missing?

The specs require that the width be specified if you use border, and do not
allow you set different widths for different sides.




Post Follow-Up to this message ]
Re: Eric Meyer on CSS question
 

Spartanicus




quote this post edit post

IP Loged report this post

Old Post  07-24-04 - 12:17 AM  
Jamie <enzymatic2009@yahoo.com> wrote:

>td#main {background: #FFD; color: black; border: 2px solid #797;
>border-width: 2px 2px 2px 1px; }
>
>Isn't it redundant to have "2px" in the border rule when you have an
>explicit border-width rule? What am I missing?

The shorthand requires all three values.

Without the shorthand the code fragment would have looked like this:

td#main {background: #FFD; color: black; border-width: 2px 2px 2px 1px;
border-style: solid; border-color: #797; }

The first saved 17 bytes.

Perhaps Eric is the frugal type :)

--
Spartanicus


Post Follow-Up to this message ]
Re: Eric Meyer on CSS question
 

e n | c k m a




quote this post edit post

IP Loged report this post

Old Post  07-24-04 - 04:16 AM  
> The shorthand requires all three values.

Shouldn't the CSS validator pick that up then? I didn't know it mattered...
Should I bother changing all of my border definitions [where I didn't st
ate
the width] then? Is it a big deal?




Post Follow-Up to this message ]
Re: Eric Meyer on CSS question
 

e n | c k m a




quote this post edit post

IP Loged report this post

Old Post  07-24-04 - 04:16 AM  
> The shorthand requires all three values.

Reading through the [2.1] specs, I don't think that's accurate... but,
correct me if I'm wrong.

This is an example taken from
http://www.w3.org/TR/CSS21/box.html#border-properties

You may need to scroll down to 'border'

<code>

p { border: solid red }
p {
border-top: solid red;
border-right: solid red;
border-bottom: solid red;
border-left: solid red
}

</code>

And,

<quote>
This is a shorthand property for setting the width, style, and color of the
top, right, bottom, and left border of a box.

Example(s):


h1 { border-bottom: thick solid red }
The above rule will set the width, style, and color of the border below the
H1 element. Omitted values are set to their initial values. Since the
following rule does not specify a border color, the border will have the
color specified by the 'color' property:

H1 { border-bottom: thick solid }
</quote>

Thus, the shorthand doesn't require all three values. Again, correct me if
I'm misinterpreting this.





Post Follow-Up to this message ]
Re: Eric Meyer on CSS question
 

Christoph Paeper




quote this post edit post

IP Loged report this post

Old Post  07-24-04 - 04:16 AM  
*Jamie* <enzymatic2009@yahoo.com>:
>
> td#main {/*...*/ border: 2px solid #797; border-width: 2px 2px 2px 1p
x; }
>
> Isn't it redundant to have "2px" in the border rule when you have an
> explicit border-width rule?

Yes, I would write it like this:

border: 2px solid #797; border-left-width: 1px;

Note that

border-width: 2px 2px 2px 1px; border: 2px solid #797;

wouldn't work as desired, because all four borders would be 2px.
Some UAs may also make borders 'medium' wide for

border-width: 2px 2px 2px 1px; border: solid #797;

but AFAIK that would be wrong, although 'medium' is the initial value for
'border-(top|right|bottom|left)-width' and (most) shorthand properties
reset to initial if no explicit values are given. They would be right if
those rules were not in the same ruleset, i.e.

foo   {border-width: 2px 2px 2px 1px;}
* foo {border: solid #797;}

I'm not totally sure about that, so CMIIW, please!

--
"The squeaking wheel doesn't always get the grease.
Sometimes it gets replaced."
Vic Gold


Post Follow-Up to this message ]
Re: Eric Meyer on CSS question
 

Spartanicus




quote this post edit post

IP Loged report this post

Old Post  07-24-04 - 09:15 AM  
"e n | c k m a" <bob@marley.com> wrote:
 
>
>Reading through the [2.1] specs, I don't think that's accurate... but,
>correct me if I'm wrong.

You are right, thanks for the correction.

The border shorthand takes one, two or three values, when specifying one
or two the other properties are set to their initial value.

--
Spartanicus


Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 02:59 PM. Post New Thread   
  Previous Last Thread   Next Thread next
Stylesheets archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top