homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: DrDoc

CSS Forum

first-child pseudo class not working in IE 6 ?

 2:23 pm on Feb 23, 2010 (gmt 0)

I am trying to use first-child pseudo class. it works fine in firefox but not in IE6.. please tell me that how can i use it to work fine in IE6 here is the code ..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<style type="text/css">

<p>This is some text.</p>
<p>This is some text.</p>



 6:24 pm on Feb 23, 2010 (gmt 0)

I do not believe that IE6 supports this pseudo class. Unless it created major usability issues, this is one of those pieces of styling that I'd just make IE6 users live without. IE6 is like nine years old and entirely obsolete. Just make sure pages degrade gracefully in IE6 and call it good. Don't try to fix things such that they are pixel perfect.


 8:34 pm on Feb 25, 2010 (gmt 0)

IE6 doesn't support :first-child. You can use javascript to pick the first child of the parent element.

var myElement = document.getElementsByTagName("body")[0];

var firstPTag = myElement.getElementsByTagName("p")[0];

firstPTag.style.color = "blue";

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved