Two CSS Classes. Is this possible?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    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
  • Jukka K. Korpela

    #2
    Re: Two CSS Classes. Is this possible?

    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/

    Comment

    • Joshua Cranmer

      #3
      Re: Two CSS Classes. Is this possible?

      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

      Comment

      • shapper

        #4
        Re: Two CSS Classes. Is this possible?

        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

        Comment

        • Jukka K. Korpela

          #5
          Re: Two CSS Classes. Is this possible?

          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/

          Comment

          • shapper

            #6
            Re: Two CSS Classes. Is this possible?

            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

            Comment

            • Harlan Messinger

              #7
              Re: Two CSS Classes. Is this possible?

              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.

              Comment

              • Jukka K. Korpela

                #8
                Re: Two CSS Classes. Is this possible?

                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/

                Comment

                • Harlan Messinger

                  #9
                  Re: Two CSS Classes. Is this possible?

                  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?

                  Comment

                  • Jukka K. Korpela

                    #10
                    Re: Two CSS Classes. Is this possible?

                    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/

                    Comment

                    • Harlan Messinger

                      #11
                      Re: Two CSS Classes. Is this possible?

                      Jukka K. Korpela wrote:
                      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".
                      Then you don't understand anything I said and you don't understand
                      statistics.
                      Everyday experience is enough here, naturally assuming that your world
                      of experience contains so-called normal users.
                      Now you're *advocating* using gut feelings ("everyday experience",
                      which, for some reason, is better used unmeasured than measured or at
                      least sampled).
                      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.
                      You evidently don't understand statistics.

                      Comment

                      • dorayme

                        #12
                        Re: Two CSS Classes. Is this possible?

                        In article <DytCk.70808$_0 3.66709@reader1 .news.saunalaht i.fi>,
                        "Jukka K. Korpela" <jkorpela@cs.tu t.fiwrote:
                        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.
                        >
                        So? If you were to employ a principle of charitable interpretation - not
                        your strong point, I know, - you would extend HM's point in a reasonable
                        rather than an unreasonable way to cover sites in general. The point is
                        this, if lots of stats were coming in for individual sites (say big well
                        known ones), and one made a rough average, then this rough average might
                        still be useful within a rough margin of error assessment. No, not
                        useless, useful. Useful. Enough for a rational person to think, "Hmm,
                        clearly better not ignore IE6's little peccadillos yet on this site I am
                        making; given that I see no special type of audience different to the
                        sorts that use the websites in the stats."

                        Look, the truth is not that you don't understand stats (as a justifiably
                        irritated HM said) but that you ... well.. you are just being you.

                        In As Good As It Gets, Helen Hunt, in exasperation says about Jack
                        Nicholson, who is one doozie of an awkward dude, that she wished he
                        would stop being himself for a moment.

                        So the
                        information is useful as long as one is aware of the margin of error
                        involved.
                        >
                        please
                        don't use pseudostatistic al terms like "margin of error".
                        It is hardly *this* in the context of this audience.

                        --
                        dorayme

                        Comment

                        • shapper

                          #13
                          Re: Two CSS Classes. Is this possible?

                          On Sep 24, 11:48 pm, dorayme <doraymeRidT... @optusnet.com.a uwrote:
                          In article <DytCk.70808$_0 3.66...@reader1 .news.saunalaht i.fi>,
                           "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
                          >
                          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 accessingthat
                          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.
                          >
                          So? If you were to employ a principle of charitable interpretation - not
                          your strong point, I know, - you would extend HM's point in a reasonable
                          rather than an unreasonable way to cover sites in general. The point is
                          this, if lots of stats were coming in for individual sites (say big well
                          known ones), and one made a rough average, then this rough average might
                          still be useful within a rough margin of error assessment. No, not
                          useless, useful. Useful. Enough for a rational person to think, "Hmm,
                          clearly better not ignore IE6's little peccadillos yet on this site I am
                          making; given that I see no special type of audience different to the
                          sorts that use the websites in the stats."
                          >
                          Look, the truth is not that you don't understand stats (as a justifiably
                          irritated HM said) but that you ... well.. you are just being you.
                          >
                          In As Good As It Gets, Helen Hunt, in exasperation says about Jack
                          Nicholson, who is one doozie of an awkward dude, that she wished he
                          would stop being himself for a moment.
                          >
                          So the
                          information is useful as long as one is aware of the margin of error
                          involved.
                          >
                          please
                          don't use pseudostatistic al terms like "margin of error".
                          >
                          It is hardly *this* in the context of this audience.
                          >
                          --
                          dorayme
                          Maybe the best approach would be to use an analysis system as Google
                          Analytics on the web site and check over time what browsers and even
                          screen size are the users using and how the evolution is for that web
                          site and then update the web site over time according to it ...

                          Comment

                          • dorayme

                            #14
                            Re: Two CSS Classes. Is this possible?

                            In article
                            <6f131dc4-3591-4511-80fc-f8968a749444@d1 g2000hsg.google groups.com>,
                            shapper <mdmoura@gmail. comwrote:
                            Maybe the best approach would be to use an analysis system as Google
                            Analytics on the web site and check over time what browsers and even
                            screen size are the users using and how the evolution is for that web
                            site and then update the web site over time according to it ...
                            The best approach is to keep worrying about IE6 until it becomes obvious
                            that you should not. Never mind all this fine argy bargy.

                            Why would you need to update a website that satisfies IE6 if it already
                            satisfies other better browsers?

                            --
                            dorayme

                            Comment

                            • shapper

                              #15
                              Re: Two CSS Classes. Is this possible?

                              On Sep 25, 1:21 am, dorayme <doraymeRidT... @optusnet.com.a uwrote:
                              In article
                              <6f131dc4-3591-4511-80fc-f8968a749...@d1 g2000hsg.google groups.com>,
                              >
                               shapper <mdmo...@gmail. comwrote:
                              Maybe the best approach would be to use an analysis system as Google
                              Analytics on the web site and check over time what browsers and even
                              screen size are the users using and how the evolution is for that web
                              site and then update the web site over time according to it ...
                              >
                              The best approach is to keep worrying about IE6 until it becomes obvious
                              that you should not. Never mind all this fine argy bargy.
                              >
                              Why would you need to update a website that satisfies IE6 if it already
                              satisfies other better browsers?
                              >
                              --
                              dorayme
                              You have a point there ...

                              I am just saying that many times when I post a problem I get an
                              solution that does not work with IE6 and other that works.

                              Usually the one that does not work with IE6 seems much more logic and
                              easier to code ...

                              But I got it ...

                              Thanks,
                              Miguel

                              Comment

                              Working...