Multiple classes

  • Not supported by Netscape 4, OmniWeb and Explorer 4 Mac.
  •  

    This page tests the assigning of multiple class names to one element.

    Example

    This paragraph should be red and large

    This paragraph should be green and large

    This paragraph should be red and small

    This paragraph should be green and small

    Explanation

    The example's HTML is:

    <p class="red large">Red and large</p>
    <p class="green large">Green and large</p>
    <p class="red small">Red and small</p>
    <p class="green small">Green and small</p>
    

    The CSS is:

    p.red {color: #cc0000;}
    p.green {color: #00cc00;}
    p.large {font-size: 120%;}
    p.small {font-size: 80%;}
    

    Do browsers assign both the correct color and the correct font size to all paragraphs? In other words, do they obey both class definitions? Overall the answer seems to be Yes, but for Netscape 4 (what else is new?).

    contents