Results 1 to 4 of 4

Thread: IE 6 and Siblings

  1. #1
    Join Date
    Jan 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default IE 6 and Siblings

    Hi,

    Having problems with IE6 and the following:

    Div#text p+p {.......}

    Is this not supported in IE? it seems fine in FF.

    Does anyone have another suggestion...I just want to pick the 2nd then 3rd, 4th.... <p> in a specified <div> and position each absolute.

    I am new to CSS so I am sure there is a better way that what I am using.

    Thx

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    IE6 simply appears not to understand what that means, a similar effect can be achieved using the Descendent Selector:

    Code:
    div p {
    color:red;
    }
    . . . with a twist. First consider that if you have a division with the id of 'text', it can be selected simply by its id. A Descendent can be used to select the targeted paragraphs, which themselves will be Descendent of the Descendent Selector (this requires an additional element in your markup though):

    Code:
    #text div p {
    color:red;
    }
    The above rule will select all but the first paragraph in the element with the id of text if the markup looks like so:

    HTML Code:
    <div id="text">
    <p>Hi</p>
    <div>
    <p>there</p><p>folks</p>
    </div></div>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Many of the more complex CSS selectors aren't supported in IE. As John said, you'll have to use a combination of simpler methods to achieve the same effect. It's not quite as robust, but it's the only choice if you want IE to be able to see the effects you apply.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    IE6 simply appears not to understand what [an adjacent selector] means
    Yes, as I wrote at the end of another post in this forum.

    Code:
    #text div p {
    color:red;
    }
    The above rule will select all but the first paragraph in the element with the id of text if the markup looks like so:

    HTML Code:
    <div id="text">
    <p>Hi</p>
    <div>
    <p>there</p><p>folks</p>
    </div></div>
    An alternative approach, that would work with other structures is:

    Code:
    #text p {
      background: transparent;
      color: red;
    }
    #text p.first {
      color: black;
    }
    HTML Code:
    <div id="text">
      <p class="first">This will be black.</p>
      <p>This will be red.</p>
      <p>So will this.</p>
    </div>
    The color property in the second, more specific rule, would override the same declaration in the first.

    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •