Welcome to WebmasterWorld Guest from 54.226.189.112

Forum Moderators: not2easy

Message Too Old, No Replies

first-child pseudo class not working in IE 6 ?

     

jawaidgadiwala

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

5+ Year Member



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">
<html>
<head>
<style type="text/css">
p:first-child
{
color:blue;
}
</style>
</head>

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

KenB

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

WebmasterWorld Senior Member 10+ Year Member



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.

joiseymike

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

5+ Year Member



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";
 

Featured Threads

Hot Threads This Week

Hot Threads This Month