Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

first-child pseudo class not working in IE 6 ?

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

New User

5+ Year Member

joined:Feb 20, 2010
posts: 11
votes: 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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 24, 2003
votes: 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)

New User

5+ Year Member

joined:Feb 25, 2010
posts: 5
votes: 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";

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members