473,395 Members | 1,766 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,395 software developers and data experts.

two class specific

We can do this:

<tr class="data odd">

Can we make a rule that applies when only both classes are present?
I suppose I could do this:

<table class="data">
<tr class="odd">...
<tr class="even">...

<table class="data2">
....

..data .odd{}

But it doesn't hurt to have another trick in the bag.

Jeff
Jul 20 '05 #1
6 2701
On Mon, 04 Oct 2004 14:16:19 GMT, Jeff Thies <je**@spamalanadingong.com>
wrote:
We can do this:

<tr class="data odd">

Can we make a rule that applies when only both classes are present?


Yes:

.data.odd {
}

An example of this is given in the CSS 2 Specification
(<URL:http://www.w3.org/TR/REC-CSS2/selector.html#class-html>).

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 20 '05 #2
Michael Winter wrote:
On Mon, 04 Oct 2004 14:16:19 GMT, Jeff Thies
<je**@spamalanadingong.com> wrote:
We can do this:

<tr class="data odd">

Can we make a rule that applies when only both classes are present?

Yes:

.data.odd {
}

An example of this is given in the CSS 2 Specification
(<URL:http://www.w3.org/TR/REC-CSS2/selector.html#class-html>).


Thanks.

Is this widely supported?

Jeff
[snip]

Mike

Jul 20 '05 #3
On Mon, 04 Oct 2004 15:51:30 GMT, Jeff Thies <je**@spamalanadingong.com>
wrote:
Michael Winter wrote:
[snip]
.data.odd {
}


[snip]
Is this widely supported?


It's supported on more modern browsers, including IE thankfully. I don't
have many old browsers though, so I can't say how far back the support
goes.

Perhaps someone else will have a better idea.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 20 '05 #4
.oO(Jeff Thies)
We can do this:

<tr class="data odd">

Can we make a rule that applies when only both classes are present?
I suppose I could do this:

<table class="data">
<tr class="odd">...
<tr class="even">...


Why do you need a class on every row? And what's wrong with the class
"data" on the table-element? Do you really want to have _two_ classes
applied to _every_ row? I would try to keep the number of classes as
small as possible, which means to make more use of cascading rules and
descendant selectors.

Micha
Jul 20 '05 #5
Michael Fesser wrote:
.oO(Jeff Thies)

We can do this:

<tr class="data odd">

Can we make a rule that applies when only both classes are present?
I suppose I could do this:

<table class="data">
<tr class="odd">...
<tr class="even">...

Why do you need a class on every row?

I haven't written any of this yet. I don't see a problem with labeling
both odd and even rows and using whichever you want later. Worse code
bloat happens!

And what's wrong with the class "data" on the table-element? Do you really want to have _two_ classes
applied to _every_ row? I would try to keep the number of classes as
small as possible, which means to make more use of cascading rules and
descendant selectors.
I'll probably do that, set either the odd or even rows as a descendant
of the table class. I agree with minimizing number of classes to
increase readability.

This will all be server generated and styled from a gloabl stylesheet.
Some data looks good grey barred and some doesn't.

I probably won't use the double class here, but I have found it usefull
when you want to take the same generated html and use it for different
purposes.

Cheers,
Jeff


Micha

Jul 20 '05 #6
On Mon, 04 Oct 2004 15:51:30 GMT, Jeff Thies <je**@spamalanadingong.com>
wrote:
Michael Winter wrote:
[snip]
.data.odd {
}


[snip]
Is this widely supported?


Whilst looking for something entirely different, I happened across this
page:

<URL:http://devedge.netscape.com/library/xref/2003/css-support/css2/selectors.html>

Though it is out-of-date, it does seem to indicate that (at least) major
browsers after the NN4/IE4 generation support multiple class selectors.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 20 '05 #7

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

Similar topics

6
by: Brian Jones | last post by:
I'm sure the solution may be obvious, but this problem is driving me mad. The following is my code: class a(object): mastervar = def __init__(self): print 'called a'
18
by: John M. Gabriele | last post by:
I've done some C++ and Java in the past, and have recently learned a fair amount of Python. One thing I still really don't get though is the difference between class methods and instance methods. I...
5
by: MPowell | last post by:
I'm going through the Koeing book Accelerated C++ in an attempt to understand Container classes. Of course I'm going through a paradigm shift from C to C++. So now I've got struct Header {...
2
by: Nancy | last post by:
I have the following situation and could use some advise. I have a Base Class CreditReport, classes BoatCreditReport and HomeCreditReport Inherit from CreditReport. I would like to have the...
166
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
9
by: Brian Henry | last post by:
If i inherite a queue class into my class, and do an override of the enqueue member, how would i then go about actually doing an enqueue of an item? I am a little confused on this one... does over...
7
by: S. Lorétan | last post by:
Hi guys, Sorry for this stupid question, but I don't know why it isn't working. Here is my (example) code: namespace Test { class A { public string Label1; }
3
by: Simon Hart | last post by:
Hi, I am trying to implement some functionality as seen in MS CRM 3.0 whereby a basic Xml is deserialized into an object which contains properties. What I want to do from here is; cast the basic...
3
by: TamusJRoyce | last post by:
Hello. This is my first thread here. My problem has probably been came across by a lot of people, but tutorials and things I've seen don't address it (usually too basic). My problem is that I...
3
by: =?Utf-8?B?RWQgS3JhbWVy?= | last post by:
I thought this might be useful for someone... I was doing a little work earlier using an Xmldocument class to create & maintain a minor store of data in Xml format. I'd gotten the whole thing...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.