Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 21st, 2005, 12:55 AM
Jeff Thies
Guest
 
Posts: n/a
Default 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
  #2  
Old July 21st, 2005, 12:55 AM
Michael Winter
Guest
 
Posts: n/a
Default Re: two class specific

On Mon, 04 Oct 2004 14:16:19 GMT, Jeff Thies <jeff@spamalanadingong.com>
wrote:
[color=blue]
> We can do this:
>
> <tr class="data odd">
>
> Can we make a rule that applies when only both classes are present?[/color]

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.
  #3  
Old July 21st, 2005, 12:55 AM
Jeff Thies
Guest
 
Posts: n/a
Default Re: two class specific

Michael Winter wrote:[color=blue]
> On Mon, 04 Oct 2004 14:16:19 GMT, Jeff Thies
> <jeff@spamalanadingong.com> wrote:
>[color=green]
>> We can do this:
>>
>> <tr class="data odd">
>>
>> Can we make a rule that applies when only both classes are present?[/color]
>
>
> 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>).[/color]

Thanks.

Is this widely supported?

Jeff[color=blue]
>
> [snip]
>
> Mike
>[/color]
  #4  
Old July 21st, 2005, 12:55 AM
Michael Winter
Guest
 
Posts: n/a
Default Re: two class specific

On Mon, 04 Oct 2004 15:51:30 GMT, Jeff Thies <jeff@spamalanadingong.com>
wrote:
[color=blue]
> Michael Winter wrote:[/color]

[snip]
[color=blue][color=green]
>> .data.odd {
>> }[/color][/color]

[snip]
[color=blue]
> Is this widely supported?[/color]

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.
  #5  
Old July 21st, 2005, 12:55 AM
Michael Fesser
Guest
 
Posts: n/a
Default Re: two class specific

.oO(Jeff Thies)
[color=blue]
>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">...[/color]

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
  #6  
Old July 21st, 2005, 12:56 AM
Jeff Thies
Guest
 
Posts: n/a
Default Re: two class specific

Michael Fesser wrote:[color=blue]
> .oO(Jeff Thies)
>
>[color=green]
>>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">...[/color]
>
>
> Why do you need a class on every row?[/color]


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[color=blue]
> "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.[/color]

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

[color=blue]
>
> Micha[/color]
  #7  
Old July 21st, 2005, 12:56 AM
Michael Winter
Guest
 
Posts: n/a
Default Re: two class specific

On Mon, 04 Oct 2004 15:51:30 GMT, Jeff Thies <jeff@spamalanadingong.com>
wrote:
[color=blue]
> Michael Winter wrote:[/color]

[snip]
[color=blue][color=green]
>> .data.odd {
>> }[/color][/color]

[snip]
[color=blue]
> Is this widely supported?[/color]

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.
 

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