HighDots Forums  

Two CSS Classes. Is this possible?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Two CSS Classes. Is this possible? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
shapper
 
Posts: n/a

Default Two CSS Classes. Is this possible? - 09-23-2008 , 12:05 PM






Hello,

Is it possible to apply a style to a div that has exactly two CSS
Classes?

<div class="A B">Test 1</div>

<div class="A">Test 2</div>

I want to change the background color of the first div because it has
classes A and B applied.

I need to be able to create like a composite class ... I think this is
not possible. Just checking.

Thanks,
Miguel

Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-23-2008 , 12:22 PM






shapper wrote:

Quote:
Is it possible to apply a style to a div that has exactly two CSS
Classes?
Of course.

Quote:
div class="A B">Test 1</div

div class="A">Test 2</div

I want to change the background color of the first div because it has
classes A and B applied.
What's the problem? You can use either the selector .A or the selector .B,
or even the selector div - or the selector *, to take things into the
extreme.

Quote:
I need to be able to create like a composite class ... I think this is
not possible. Just checking.
I think you are not really describing the problem. I guess you mean that the
CSS rules should _only_ apply to a div that has both classes.

For this, you would just the selector

div.A.B

--
Yucca, http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #3  
Old   
Joshua Cranmer
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-23-2008 , 12:23 PM



shapper wrote:
Quote:
Hello,

Is it possible to apply a style to a div that has exactly two CSS
Classes?

div class="A B">Test 1</div

div class="A">Test 2</div

I want to change the background color of the first div because it has
classes A and B applied.
..A.B will style all elements with both classes A and B, but this does
not work on IE 6.0 (although it does on IE 7+).

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth


Reply With Quote
  #4  
Old   
shapper
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-23-2008 , 02:24 PM



On Sep 23, 5:22*pm, "Jukka K. Korpela" <jkorp... (AT) cs (DOT) tut.fi> wrote:
Quote:
shapper wrote:
Is it possible to apply a style to a div that has exactly two CSS
Classes?

Of course.

div class="A B">Test 1</div

div class="A">Test 2</div

I want to change the background color of the first div because it has
classes A and B applied.

What's the problem? You can use either the selector .A or the selector .B,
or even the selector div - or the selector *, to take things into the
extreme.

I need to be able to create like a composite class ... I think this is
not possible. Just checking.

I think you are not really describing the problem. I guess you mean that the
CSS rules should _only_ apply to a div that has both classes.

For this, you would just the selector

div.A.B

--
Yucca,http://www.cs.tut.fi/~jkorpela/
Hi,

Yes I meant div.A.B ...

I didn't know how to explain it.

As usual, it does not work in IE 6 ... Does anyone has some statistics
for how IE 6 is still used?

Do you still care about IE6 or not? Just wondering ...

Thanks,
Miguel


Reply With Quote
  #5  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-23-2008 , 02:39 PM



shapper wrote:

Quote:
As usual, it does not work in IE 6 ...
So what? You remember the usual CSS caveats, don't you?

Quote:
Does anyone has some statistics
for how IE 6 is still used?
Lies, blatant lies, statistics, Internet statistics - do you really want to
go that way?

Quote:
Do you still care about IE6 or not?
You haven't told which kind of optional presentational suggestions (which is
all you can say in CSS) you are trying to make, so how could _we_ decide
whether it matters that the most common (?) browser ignores them? And you
haven't explained why you would need to use a two-class selector instead of
something more robust.

--
Yucca, http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #6  
Old   
shapper
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-23-2008 , 08:16 PM



On Sep 23, 7:39*pm, "Jukka K. Korpela" <jkorp... (AT) cs (DOT) tut.fi> wrote:
Quote:
shapper wrote:
As usual, it does not work in IE 6 ...

So what? You remember the usual CSS caveats, don't you?

Does anyone has some statistics
for how IE 6 is still used?

Lies, blatant lies, statistics, Internet statistics - do you really want to
go that way?

Do you still care about IE6 or not?

You haven't told which kind of optional presentational suggestions (whichis
all you can say in CSS) you are trying to make, so how could _we_ decide
whether it matters that the most common (?) browser ignores them? And you
haven't explained why you would need to use a two-class selector instead of
something more robust.

--
Yucca,http://www.cs.tut.fi/~jkorpela/
I don't need but it would make my CSS shorter because I would use less
classes in my code ...

As I said, I was just wondering if this was possible ... it would be
good in some cases.

I am developing following W3C rules and I don't ignore IE6 ...

But I suppose there will be one day when IE6 will be not commonly
used. I hope the day is not that far :-)

Thank You,
Miguel


Reply With Quote
  #7  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-24-2008 , 10:58 AM



Jukka K. Korpela wrote:
Quote:
shapper wrote:

As usual, it does not work in IE 6 ...

So what? You remember the usual CSS caveats, don't you?

Does anyone has some statistics
for how IE 6 is still used?

Lies, blatant lies, statistics, Internet statistics - do you really want
to go that way?
If, for example, the statistics for a government website that receives
over 40,000 visits a day show that 28% of the requests from IE are
currently from IE6 (as is the case), the actual usage may be 35% or 25%
or 20% but it's really unlikely that it's 5% or 1%. So the information
is useful as long as one is aware of the margin of error involved.

Having said that, a new Sharepoint-based application was showing that
90%+ of its hits were coming from IE4. It turned out that the
application's own content indexer was being identified as IE4.


Reply With Quote
  #8  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-24-2008 , 12:04 PM



Harlan Messinger wrote:

Quote:
Lies, blatant lies, statistics, Internet statistics - do you really
want to go that way?

If, for example, the statistics for a government website that receives
over 40,000 visits a day show that 28% of the requests from IE are
currently from IE6 (as is the case), the actual usage may be 35% or
25% or 20%
Or something else. Moreover, which "actual usage"? Usage when accessing that
site, or web access in general? One site's statistics, even if it were
meaningful in its own context, says nothing about another site's usage.

By the way, according to most statistics I've seen, IE 6 is still more
common than IE 7, or about equally common. Anything older than IE 6 is
almost ignorable by now, which is of course good news to authors.

Quote:
So the
information is useful as long as one is aware of the margin of error
involved.
Which margin of error? You don't know it. You _might_ have a reasonable
good estimate of the margin error for a _site_ (that is, you might be able
to say that with reasonable probability, visits to a particular site are
made with, say, IE 6 in 40 - 60 % of cases. But regarding web usage in
general, what would you base the estimates on? Gut feeling? Then please
don't use pseudostatistical terms like "margin of error".

--
Yucca, http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #9  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-24-2008 , 01:10 PM



Jukka K. Korpela wrote:
Quote:
Harlan Messinger wrote:

Lies, blatant lies, statistics, Internet statistics - do you really
want to go that way?

If, for example, the statistics for a government website that receives
over 40,000 visits a day show that 28% of the requests from IE are
currently from IE6 (as is the case), the actual usage may be 35% or
25% or 20%

Or something else. Moreover, which "actual usage"? Usage when accessing
that site, or web access in general? One site's statistics, even if it
were meaningful in its own context, says nothing about another site's
usage.

By the way, according to most statistics I've seen, IE 6 is still more
common than IE 7, or about equally common. Anything older than IE 6 is
almost ignorable by now, which is of course good news to authors.

So the
information is useful as long as one is aware of the margin of error
involved.

Which margin of error? You don't know it. You _might_ have a reasonable
good estimate of the margin error for a _site_ (that is, you might be
able to say that with reasonable probability, visits to a particular
site are made with, say, IE 6 in 40 - 60 % of cases. But regarding web
usage in general, what would you base the estimates on? Gut feeling?
Then please don't use pseudostatistical terms like "margin of error".
Absent any particular reason to think that the millions of otherwise
diverse people with IE6 have substantially different browsing habits
from the millions of otherwise diverse people with IE7, it's a
reasonably good estimate for the population at large. That isn't a gut
feeling, it's a statistically sound observation. And so I chose to use a
pedestrian term instead of "confidence interval" or "standard error".
Got anything else pointless to pick on while you're at it? Would you
like to challenge me on degrees of freedom and Bayesian analysis while
you're at it?


Reply With Quote
  #10  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Two CSS Classes. Is this possible? - 09-24-2008 , 01:42 PM



Harlan Messinger wrote:

[excessive quotation, always a useful indicator]

Quote:
Absent any particular reason to think that the millions of otherwise
diverse people with IE6 have substantially different browsing habits
from the millions of otherwise diverse people with IE7, it's a
reasonably good estimate
You verbosely try to put the burden of proof on anyone who asks what you
base your statements on.

Quote:
That isn't a gut
feeling, it's a statistically sound observation.
You haven't expressed anything statistical. Just some babbling followed by a
claim on being "statistically sound".

Everyday experience is enough here, naturally assuming that your world of
experience contains so-called normal users.

We don't _need_ any statistics for deciding that we still have IE 6 users
with us. Still less we need off-topic pseudo-statistics.

--
Yucca, http://www.cs.tut.fi/~jkorpela/



Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.