473,378 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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;}
Jul 20 '05 #1
3 4862
Fizgig wrote:
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? .defTable tr { border-top: 1px solid #5F2028; border-bottom: 1px solid
.selectedRow { background-color: #FABF87;}


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ä
Jul 20 '05 #2
"Fizgig" <fi****@NOequanimitySPAM.nl> wrote:
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? .defTable tr { border-top: 1px solid #5F2028; border-bottom: 1px solid
#5F2028; background-color: #FDE6D0;}

.selectedRow { background-color: #FABF87;}


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 <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #3
That does the trick! I'm such a newbie ;-)

Thank you Lauri & Steve
"Steve Pugh" <st***@pugh.net> wrote in message
news:p8********************************@4ax.com...
"Fizgig" <fi****@NOequanimitySPAM.nl> wrote:
I've applied the defTable style to a table (snip 1 below), but when i assigna single TR in that table another style with a different background color
(snip 2 below), the background color isn't overridden. What goes wrong?

.defTable tr { border-top: 1px solid #5F2028; border-bottom: 1px solid
#5F2028; background-color: #FDE6D0;}

.selectedRow { background-color: #FABF87;}


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 <st***@pugh.net> <http://steve.pugh.net/>

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ali Eghtebas | last post by:
Hi, I have 3 questions regarding the code below: 1) Why can't I trap the KEYDOWN while I can trap KEYUP? 2) Is it correct that I use Return True within the IF-Statement? (I've already read...
9
by: James Marshall | last post by:
I'm writing a library where I want to override document.write(), but for all document objects; thus, I want to put it in the prototype. I tried Document.prototype.write= my_doc_write ; but it...
8
by: Edward Diener | last post by:
Is it possible for a derived class to override a property and/or event of its base class ?
5
by: Hongzheng Wang | last post by:
Hi, I have a problem about the overriding of private methods of base class. That is, if a method f() of base class is private, can the derived class overriding f() be overriding? For...
8
by: Massimiliano Alberti | last post by:
Can I specialize a template function in a subclass without overriding it? (the main template function is defined in a base class). Now I'm doing something like that: (in base class)...
5
by: zero | last post by:
I'm having trouble with overriding methods in subclasses. I'll explain the problem using some code: class BaseClass { protected: void method2(); public: void method1();
3
by: Amin Sobati | last post by:
Hi, I have two classes. Class2 inhertis Class1: ----------------------------- Public Class Class1 Public Overridable Sub MySub() End Sub End Class Public Class Class2
1
by: tshad | last post by:
I have a DataGrid where I want the text in the cells to be black. But I want the header to have a black background and white text. The problem is the settings in the DataGrid are not overriding...
10
by: r035198x | last post by:
The Object class has five non final methods namely equals, hashCode, toString, clone, and finalize. These were designed to be overridden according to specific general contracts. Other classes that...
1
by: Alexio | last post by:
I have two similar function that need to be combined. Individually they both work however combined one over rides the other. The code is attached below and an attachment is included for data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.