473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

My menu again...

Ok, so I've used the suggestion I got earlier.

<div class="menu level0 haschildren active">Front page</div>

.menu.level0.haschildren.active { ... }

This doesn't work in IE, of course - so how would you solve the above in IE?
I.e. how do you assign multiple selectors to one object and then assign a style
to any given combination of said selectors? I can't find any good reference on
the above technique, and all selector grouping all deals with E > F, E + F and
stuff like that, not the above.

I tried

<div class='menu' level='level0' ...>

DIV[class=menu][level=level0] { ... }

And that worked in Safari, but not IE. It's a real shame that IE is what we
have to design for for our clients, but that's the harsch reality, so one need
to find workarounds all the time.

Any suggestions on how to solve the above?

The menu can be found on

<http://dev4.eklundh.com>

and the stylesheet at

<http://dev4.eklundh.com/include/styles.css>

--
Sandman[.net]
Jul 20 '05 #1
4 1937
> <div class="menu level0 haschildren active">Front page</div>

Correct.
.menu.level0.haschildren.active { ... }


You should use:

..menu, .level0, .haschildren, .active { ... }

Note the commas.
HTH,

Nick.
Jul 20 '05 #2
In article <eE*****************@news-server.bigpond.net.au>,
"e n | c k m a" <bo*@marley.com> wrote:
<div class="menu level0 haschildren active">Front page</div>


Correct.
.menu.level0.haschildren.active { ... }


You should use:

.menu, .level0, .haschildren, .active { ... }

Note the commas.


Uhm, that's not right. You use commas to group classes, such as:

.foo { color: red; }
.bar { color: red; }
.rab { color: red; }

Equals:

.foo, .bar, .rab { color: red; }

And you use spaces when you declare their relation:

.foo { color: red; }
.foo .bar { color: green; }
.bar { color: yellow; }

Produces:

<span class='foo'>This is red <span class='bar'>This is green</span></span>
<span class='bar'>This is yellow</span>

But what I want to do is creating specific matching groups. I want to use
keywords in a selector and tie styles to combinations to them, as a typical
menu would require.

So, the menu would typically look like this:

Front page
Sub page
Sub page 2

And it's hiearchical, so it actually looks like this:

Front page
Sub page
Sub page 2

Oh, and "Front page" should have a specific look if has children, and each
should have different apparence depending on what level of the hierarchy they
are found. So, the keywords above would be:

Front page level0 active haschildren
Sub page level1 inactive nochildren
Sub page 2 level1 active nochildren

This would mean that "Sub page 2" is the active menu (and that means that the
'Front page' part is active as well. So I want to apply a specific rule to this
specific state of the menu. The CSS2.1 specification says:

"For example, the following rule matches any P element whose "class"
attribute has been assigned a list of space-separated values that includes
"pastoral" and "marine":

p.pastoral.marine { color: green }

This rule matches when class="pastoral blue aqua marine" but does not match
for class="pastoral blue"."

And this is exactly what I want to do - and it works perfectly in Safari for
Mac, but breaks horribly in IE for PC (as most CSS-related stuff do).

Which is why I am asking here if there is any way to achieve the same result as
the CSS2.1 specs specify with IE?

--
Sandman[.net]
Jul 20 '05 #3
> Uhm, that's not right. You use commas to group classes, such as:

.foo { color: red; }
.bar { color: red; }
.rab { color: red; }

Equals:

.foo, .bar, .rab { color: red; }
You're right, sorry - I misunderstood what you were asking.
p.pastoral.marine { color: green }

This rule matches when class="pastoral blue aqua marine" but does not
match
for class="pastoral blue"."

And this is exactly what I want to do - and it works perfectly in Safari
for
Mac, but breaks horribly in IE for PC (as most CSS-related stuff do).
Actually, it works in IE - I just checked. Either what you're trying to
achieve is different or you're doing it wrong somehow.
Which is why I am asking here if there is any way to achieve the same
result as
the CSS2.1 specs specify with IE?


Still not entirely sure what you're trying to do [sorry! i'm pretty tired
right now, maybe someone else can help]. Try using less classes though, it's
more elegant to say:

#menu ul {...}
#menu li { ... }

and then maybe start introducing the nested classes.

#menu li .subPage { ... }
#menu li .active { ... }
#menu li .inactive { ... }

<div id="menu">
<ul>
<li class="active">...</li>
<li>
<ul>
<li class="subPage inactive">...</li>
</ul>
</li>
</ul>
</div>

Anyway, muck around with it - I'm sure the answer is out there. It should
work quite easily on all browsers, though. Perhaps you're trying to make it
more complicated than it is?

HTH somehow...

Nick.
Jul 20 '05 #4
In article <NU*****************@news-server.bigpond.net.au>,
"e n | c k m a" <bo*@marley.com> wrote:
p.pastoral.marine { color: green }

This rule matches when class="pastoral blue aqua marine" but does not
match for class="pastoral blue"."

And this is exactly what I want to do - and it works perfectly in Safari
for Mac, but breaks horribly in IE for PC (as most CSS-related stuff do).
Actually, it works in IE - I just checked. Either what you're trying to
achieve is different or you're doing it wrong somehow.


No, it doesn't work. Look at:

http://www.sandman.net/test_plain.php

Look at the source.

.foo.bar.rab { color: green; }
.oof.bar.rab { color: red; }

<li><span class="bar foo rab null">This is supposed to be green</span>
<li><span class="bar oof rab null">This is supposed to be red</span>

In Safari, this works like a charm, but in IE - both are red, since "bar foo
rab null" somehow actually matches the declaration for ".foo.bar.rab"
Which is why I am asking here if there is any way to achieve the same
result as
the CSS2.1 specs specify with IE?


Still not entirely sure what you're trying to do [sorry! i'm pretty tired
right now, maybe someone else can help]. Try using less classes though, it's
more elegant to say:


My original post outlined it quite good I think. I want to assign several
selectors to a given item and then apply styles to specific combinations of
those selectors. A menu item can have any of these selectors: active/inactive,
haschildren/nochildren, level#

So, if I want an active submenu that has children to have a small arrow and be
green, I might use this:

.active.level2.haschildren { background-image: url(arrow.gif); color: green; }

But when a top-level menu is active and has children, I'll use this:

.active.level1.haschildren { background-image: url(arrow2.gif); color: red; }

And so on.
#menu ul {...}
#menu li { ... }

and then maybe start introducing the nested classes.

#menu li .subPage { ... }
#menu li .active { ... }
#menu li .inactive { ... }

<div id="menu">
<ul>
<li class="active">...</li>
<li>
<ul>
<li class="subPage inactive">...</li>
</ul>
</li>
</ul>
</div>


I will try to do something with this, but I don't see how this will reduce the
number of classes I apply to an item from four to one.

--
Sandman[.net]
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John Pote | last post by:
I have a menu bar in a top level window as follows menuBar = Menu(rootWin) menuBar.add_command( label='Quit', command=rootWin.quit) configMenu = Menu(menuBar, tearoff=0)...
5
by: Rob Mayo | last post by:
How can I force a MeasureItem message for an owner-dramn menu item? Here is the dilemma. I wrote a lovely little Component for owner-drawing all the menus on a form and making them look like...
5
by: Andy | last post by:
Hi I am writing a small calculator program using switch() for a menu. The menu is presented at first, selection read in via scanf(), and calculation is executed. At the end of the operation, the...
7
by: VB Programmer | last post by:
How do I create a submenu so that I can only check ONE of the values? Example: Menu --> Color SubMenu --> Red Value 1 --> Yellow Value 2 --> Green Value 3 Thanks....
2
by: Edward K. Ream | last post by:
Hi, I've spent a pleasant hour or so trying to bring up a top-level Tk menu at the same spot as it would appear if I had actually clicked the menu. That is, I want to bring up a menu from...
8
by: gs | last post by:
I was able to set tooltips on objects other than main menu. I would like to get the effect of tooltip or microhelp in the bottom status bar when the mouse is hovering over a submenu item. How do...
2
by: Gary Wessle | last post by:
Hi I need help organizing this program in the right way. I included the code below which compiles and runs and gives the desired effect to a certain point, but I don't know what the next step...
14
namcintosh
by: namcintosh | last post by:
Hello, everyone. Well, let me cut to the chase and explain my problem. I am trying to devise a menu plan that uses the if/else if and the while loop. The program calculates the user's weight...
4
by: Karl | last post by:
Hi all, I want to write an application that is launched from the context menu in Windows Explorer/Computer. That is to say, when I am browsing around my hard drive and get to any location I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.