homepage Welcome to WebmasterWorld Guest from 50.17.27.205
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
first-child pseudo class not working in IE 6 ?
jawaidgadiwala




msg:4085568
 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">
<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




msg:4085750
 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.

joiseymike




msg:4087344
 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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved