473,666 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Two CSS Classes. Is this possible?

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
Sep 23 '08 #1
14 1689
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/

Sep 23 '08 #2
shapper wrote:
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
Sep 23 '08 #3
On Sep 23, 5:22*pm, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
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
Sep 23 '08 #4
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 (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/

Sep 23 '08 #5
On Sep 23, 7:39*pm, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
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
Sep 24 '08 #6
Jukka K. Korpela wrote:
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.
Sep 24 '08 #7
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 pseudostatistic al terms like "margin of error".

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

Sep 24 '08 #8
Jukka K. Korpela wrote:
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 pseudostatistic al 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?
Sep 24 '08 #9
Harlan Messinger wrote:

[excessive quotation, always a useful indicator]
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.
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 "statistica lly 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/

Sep 24 '08 #10

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

Similar topics

18
8732
by: vrillusions | last post by:
I've been using functions since I first started using php, but I've been hearing more and more about classes, which I never really looked at that much. I understand the whole OO programming aspect, but are there any advantages to having classes as opposed to just functions? I've heard that the classes are better because they only load the functions they need to, where with an include file of functions, the whole page gets loaded, even if...
4
2073
by: Tuure Laurinolli | last post by:
Someone pasted the original version of the following code snippet on #python today. I started investigating why the new-style class didn't work as expected, and found that at least some instances of new-style classes apparently don't return true for PyInstance_Check, which causes a problem in PySequence_Check, since it will only do an attribute lookup for instances. Things probably shouldn't be this way. Should I go to python-dev with...
1
741
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a managed point-of-view I've noticed that: 1) for each managed and unmanaged C function (not C++ classes) I get a public managed static method (defined on a 'Global Functions' class) in the generated assembly with an export name of the form...
45
3594
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes themselves are an exception to this), and 'bootstrap' your program by instantiating a single application object in main(), would that place any limitations on what you could accomplish with your program? Are there any benefits to doing things that...
5
7632
by: Bharat Karia | last post by:
Hi, Is it possible to writed Sealed classes in C++ . i.e. there is no sealed/final keyword in C++, but is it possible to achieve the same effect? i.e. deriving from a sealed class is an error and the compiler should flag it as such. Thanks Bharat Karia
4
1804
by: john townsley | last post by:
do people prefer to design classes for the particular job or for a rangle of tasks they might encounter now and in the future. i am doing some simple win32 apps and picking classes is simple, but understanding others peoples logic isnt (that doesnt mean they are wrong). i prefer designing classes for the currect job and making tangible 'things' classes , not overdoing it with loads of classes or inheritance.. it seems easier to make...
9
2518
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. I.e. do we have to need to write:
11
2716
by: C# Learner | last post by:
Is it not possible to declare a nested class in a seperate file from its "parent" class -- i.e. in a similar way to the idea of spreading namespaces over more than one file?
11
3818
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you experts. I would like to produce Javascript classes that can be "subclassed" with certain behaviors defined at subclass time. There are plenty of ways to do this through prototyping and other techniques, but these behaviors need to be static and...
86
4607
by: jopperdepopper | last post by:
Hi, finally giving php 5 a go, and going over the new approach to classes. Can someone clarify the public, private and protected to me? I quote the php manual: "The visibility of a property or method can be defined by prefixing the declaration with the keywords: public, protected or private. Public declared items can be accessed everywhere."
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.