20 replies [Last post]
bubs
Offline
Regular
Last seen: 12 years 34 weeks ago
Timezone: GMT-5
Joined: 2006-05-22
Posts: 15
Points: 0

I have a css menu that uses a child selector to display a submenu. obviously it doesn't work in IE since the selector is not supported. does anyone know of a workaround or "hack" that could get this to work or simulate a child selector. I can't show the site cause its for work. so I just need a basic explanation or a link to another site or something cause I know you guys need to see the page to debug it, but unfortunatly i can't do that. sorry. but I would think that this would be a somewhat common delima for some people, and I want to know how you get around it. also I'm not apposed to using javascript but I'm not very handy in it.

stonewall
stonewall's picture
Offline
Enthusiast
between a rock and a hard place
Last seen: 13 years 27 weeks ago
between a rock and a hard place
Timezone: GMT-5
Joined: 2006-04-06
Posts: 93
Points: 0

child selector for IE

can you not use a descendant selector?

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 45 weeks 4 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Re: child selector for IE

bubs wrote:
I have a css menu that uses a child selector to display a submenu. obviously it doesn't work in IE since the selector is not supported. does anyone know of a workaround or "hack" that could get this to work or simulate a child selector.

In the absence of some code to look at I'm guessing that it's not the selector that is the likely cause of your problem but the fact that IE doesn't support the "hover" pseudo element for anything but the <a> tag.

There are ways to work around this, either with javascript to make IE honor the element, or with pure CSS. The former is more elegant but runs into the problem that many people turn javascript off in their browsers. The latter means your html ibecomes more convoluted.

There is an article at the CSS Edge site that shows how to do it with just CSS.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

bubs
Offline
Regular
Last seen: 12 years 34 weeks ago
Timezone: GMT-5
Joined: 2006-05-22
Posts: 15
Points: 0

child selector for IE

I'll make an example of what i'm doing when I get home Wink

but its a simple menu made from lists. and your right it is the :hover only supported on "a" in IE. its a tab list that I found in a demo and wanted to use it and it looks like a tab you roll over it and it pops out and shows a list of links. but I wanted to take it a step further and have a sublist when you rolled over the first list.

it works in firefox useing the child selctor ">" and I wanted to know if I could get it to work in IE.

but like I said give me a few hours to get home from work and I'll make up and example and post it.

Smile

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 45 weeks 4 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

child selector for IE

bubs wrote:

it works in firefox useing the child selctor ">" and I wanted to know if I could get it to work in IE.

I believe you'll find that IE6 and below don't recognize either the > or + selectors, alas.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

bubs
Offline
Regular
Last seen: 12 years 34 weeks ago
Timezone: GMT-5
Joined: 2006-05-22
Posts: 15
Points: 0

child selector for IE

yea. alas...

but I wanted to know if there was a workaround or *hack* that could get the same result

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 45 weeks 4 days ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

child selector for IE

bubs wrote:
but I wanted to know if there was a workaround or *hack* that could get the same result

Not that I know of, but then there's quite a lot I don't know of...

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

stonewall
stonewall's picture
Offline
Enthusiast
between a rock and a hard place
Last seen: 13 years 27 weeks ago
between a rock and a hard place
Timezone: GMT-5
Joined: 2006-04-06
Posts: 93
Points: 0

child selector for IE

hello?

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 7 years 3 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

child selector for IE

there is a sort of work around, you need to reset the child style rule when some element appears between the two elements that you want to have a parent>child style relationship.

.first>.second {some style properties }

is equivalent to

.first .second {some style properties }
.first * .second { reset the some style properties back to default values}

e.g.

* { color: black; }
.first > .second { color: red; }

.first .second { color: red; }
.first * .second { color: black; }

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 4 years 40 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

child selector for IE

Laughing out loud just as stonewall was trying to allude to.

You have to shout stonewall Smile

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

stonewall
stonewall's picture
Offline
Enthusiast
between a rock and a hard place
Last seen: 13 years 27 weeks ago
between a rock and a hard place
Timezone: GMT-5
Joined: 2006-04-06
Posts: 93
Points: 0

child selector for IE

OH OKAY, SORRY. IS THIS BETTER!? Laughing out loud

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 7 years 3 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

child selector for IE

A tiny, itsy bitsy bit of an explanation would help as well. Wink

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 4 years 40 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

child selector for IE

Socratic method Chris Wink lets not always be so quick to trot out the silver platter.

We had a good discussion about this a year and a half ago-ish must see if I can drag it up.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 7 years 3 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

child selector for IE

Oh right ... socrates.

With all due respect to you and stonewall, I think "can you not use a descendent selector?" is only fractionally more use than "yep, there is a solution, use CSS". The bare minimum for this question would have to be "try using a combination of two descendent selectors".

Anyone for hemlock?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 4 years 40 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

child selector for IE

With all due respect it's still the socratic method; to engage the student in discourse.

Fractionally more use or not misses the point.

and can you have a descendent selector less than two?
or maybe you meant a combination of two descendent selector rulesets.

But I nit pick and you are quite correct a simple example/explanation was in order.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 7 years 3 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

child selector for IE

Hugo wrote:
or maybe you meant a combination of two descendent selector rulesets.

Yes, that's what I meant. Laughing out loud

There is just too much of the socrating going around at the moment. Wink

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 4 years 40 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

child selector for IE

Chris..S wrote:
Hugo wrote:
or maybe you meant a combination of two descendent selector rulesets.


Yes, that's what I meant. Laughing out loud

There is just too much of the socrating going around at the moment. Wink


Is there Shock (Socratic irony! Smile )

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

bubs
Offline
Regular
Last seen: 12 years 34 weeks ago
Timezone: GMT-5
Joined: 2006-05-22
Posts: 15
Points: 0

child selector for IE

thanks guys I'll try this out then get back to you.

bubs
Offline
Regular
Last seen: 12 years 34 weeks ago
Timezone: GMT-5
Joined: 2006-05-22
Posts: 15
Points: 0

child selector for IE

also sorry stone I didn't understand what you were getting at in the first reply.

bubs
Offline
Regular
Last seen: 12 years 34 weeks ago
Timezone: GMT-5
Joined: 2006-05-22
Posts: 15
Points: 0

child selector for IE

ok heres something that I've been messing with today. I found a little javascript code that makes it work. (i'll still try the other method but this one almost works)

the only problem is that the menu that pops out is crammed into a tiny box. and if I make the box bigger, only the last event shows up.

heres the linkhttp://www.indint.com/tab/test.html

bubs
Offline
Regular
Last seen: 12 years 34 weeks ago
Timezone: GMT-5
Joined: 2006-05-22
Posts: 15
Points: 0

child selector for IE

oh and it only shows up in IE cause I only have the IE css in it.