Multiple css selector problems

When trying to add a style for a element based on its id and class, i.e.
HTML:
<div id="myID" class="class1 class2">Text</div>

CSS:
#myID.class1 {border:1px solid red;}

Internet Explorer 6 (IE6) and below don't support this multiple selector capability.

Workaround:

  • Define the style inline
  • Add the class to a parent element and then select based on class and then id
  • Define a parent element and place the class on the parent

Workaround example:
HTML:
<div class="class1 class2"><p id="myID">Text</p></div>

CSS:
.class1#myID {border:1px solid red;}

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options