Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 11:41 PM
Fizgig
Guest
 
Posts: n/a
Default Overriding table row color

Hi,

I've applied the defTable style to a table (snip 1 below), but when i assign
a single TR in that table another style with a different background color
(snip 2 below), the background color isn't overridden. What goes wrong?

Thanx,

Ward


snip 1 ###############


..defTable { border-collapse: collapse; }
..defTable tr { border-top: 1px solid #5F2028; border-bottom: 1px solid
#5F2028; background-color: #FDE6D0;}
..defTable td
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}


snip 2 ###############

..selectedRow { background-color: #FABF87;}


  #2  
Old July 20th, 2005, 11:41 PM
Lauri Raittila
Guest
 
Posts: n/a
Default Re: Overriding table row color

Fizgig wrote:[color=blue]
> Hi,
>
> I've applied the defTable style to a table (snip 1 below), but when i assign
> a single TR in that table another style with a different background color
> (snip 2 below), the background color isn't overridden. What goes wrong?[/color]
[color=blue]
> .defTable tr { border-top: 1px solid #5F2028; border-bottom: 1px solid
> .selectedRow { background-color: #FABF87;}[/color]

First is more specific. Use tr.selectedRow instead.
See spec for cascading rules


--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
I'm looking for work | Etsin työtä
  #3  
Old July 20th, 2005, 11:41 PM
Steve Pugh
Guest
 
Posts: n/a
Default Re: Overriding table row color

"Fizgig" <fizgig@NOequanimitySPAM.nl> wrote:
[color=blue]
>I've applied the defTable style to a table (snip 1 below), but when i assign
>a single TR in that table another style with a different background color
>(snip 2 below), the background color isn't overridden. What goes wrong?[/color]
[color=blue]
>.defTable tr { border-top: 1px solid #5F2028; border-bottom: 1px solid
>#5F2028; background-color: #FDE6D0;}
>
>.selectedRow { background-color: #FABF87;}[/color]

Specificity

The first selector has a specificity of 11 and the second has a
specificity of 10 so the first one always overrides the second one.

See http://www.w3.org/TR/CSS2/cascade.html#specificity

You need to make the second one more specific (or equally specific if
it is defined later in the CSS).

..defTable tr.selectedRow has a specficity of 21.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>
  #4  
Old July 20th, 2005, 11:41 PM
Fizgig
Guest
 
Posts: n/a
Default Re: Overriding table row color

That does the trick! I'm such a newbie ;-)

Thank you Lauri & Steve


"Steve Pugh" <steve@pugh.net> wrote in message
news:p886b094d32csn2b32q9uu1gjm9v1vskq8@4ax.com...[color=blue]
> "Fizgig" <fizgig@NOequanimitySPAM.nl> wrote:
>[color=green]
> >I've applied the defTable style to a table (snip 1 below), but when i[/color][/color]
assign[color=blue][color=green]
> >a single TR in that table another style with a different background color
> >(snip 2 below), the background color isn't overridden. What goes wrong?[/color]
>[color=green]
> >.defTable tr { border-top: 1px solid #5F2028; border-bottom: 1px solid
> >#5F2028; background-color: #FDE6D0;}
> >
> >.selectedRow { background-color: #FABF87;}[/color]
>
> Specificity
>
> The first selector has a specificity of 11 and the second has a
> specificity of 10 so the first one always overrides the second one.
>
> See http://www.w3.org/TR/CSS2/cascade.html#specificity
>
> You need to make the second one more specific (or equally specific if
> it is defined later in the CSS).
>
> .defTable tr.selectedRow has a specficity of 21.
>
> Steve
>
> --
> "My theories appal you, my heresies outrage you,
> I never answer letters and you don't like my tie." - The Doctor
>
> Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles