Forum Moderators: not2easy

Message Too Old, No Replies

Child selectors

Do they work in IE?

         

dingman

7:19 pm on Dec 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A couple days ago, I set up a style sheet with a rule that looked more or less like:

.classname > *, .anotherclass > *, .onemore > * {
padding-top: #ex;
}

And it worked fine in Mozilla, but IE6 (the only IE we have at work) completely ignored it. If I took out all the '>'s, so that it selected any descendent rather than just children, IE was fine but the effect was predictably not what I was after.

As it happens, * is a stand-in for only two possible tags, and those tags will never be nested further down than children in the documents I was writing a style sheet for, so I have those pages looking just fine by writing the rule with twice as many options in the selector.
(.classname tag1, .classname tag2, etc) However, this isn't a solution that would always work. Are there better work-arounds?

Nick_W

10:25 am on Dec 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unfortunately the support for child selectors is pretty thin. The only browsers that support them are NS6+ IE5 Mac and Opera 5+

IE6 has zero support for them.

Not sure of a workaround. Anyone?

Nick

WibbleWobble

2:51 pm on Dec 23, 2002 (gmt 0)

10+ Year Member



I think you're stuck with writing out individual classes and ids, I'm afraid. The child selector parses badly in IE, which, while making it render boxes correctly, also leaves it unable to handle children. Another triumph for Microsoft, indeed.