473,387 Members | 1,779 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,387 software developers and data experts.

Assigning multiple keywords to define a style

I have a script that generates a hierarchical menu, but I am having problems
assigning styles to each manu items different possible states. The possible
states a menu item can be in is (and all of these can be combined unless they
are mutually exclusive):

1. It can belong to a specific level in the hierarchy; 1, 2, 3 and so on.
2. It is the active menu
3. It is an inactive menu
4. It has children
5. It does not have children

As you see, there are quite a lot of things a specific menu can belong to, such
as:

Menu item "Front page" may belong to level 1, be the active menu and have
children - and should have an apparence that coprrespondes to this.

Is there a way to assign multiple classes, or in any other way manage this
parrticular menus look? In pseudo-code:

<div class="menu,level1,active,haschildren">Front Page</div>

And

.menu .level1 .active .haschildren { ... }

Any way to do this?

--
Sandman[.net]
Jul 20 '05 #1
7 2344
Sandman <mr@sandman.net> wrote:
I have a script that generates a hierarchical menu, but I am having problems
assigning styles to each manu items different possible states. The possible
states a menu item can be in is (and all of these can be combined unless they
are mutually exclusive):

1. It can belong to a specific level in the hierarchy; 1, 2, 3 and so on.
2. It is the active menu
3. It is an inactive menu
4. It has children
5. It does not have children

As you see, there are quite a lot of things a specific menu can belong to, such
as:

Menu item "Front page" may belong to level 1, be the active menu and have
children - and should have an apparence that coprrespondes to this.

Is there a way to assign multiple classes, or in any other way manage this
parrticular menus look? In pseudo-code:

<div class="menu,level1,active,haschildren">Front Page</div>
Almost--separate the class names with spaces.

And

.menu .level1 .active .haschildren { ... }


No, define the style of each class independently.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #2
Sandman wrote:
Is there a way to assign multiple classes, or in any other
way manage this parrticular menus look?

<div class="menu,level1,active,haschildren">Front Page</div>
<div class="menu level1 active haschildren">Front Page</div>

.menu .level1 .active .haschildren { ... }


..menu.level1.active.haschildren {
/* styles only for element that has _all_
of these classes */
}

..menu {
/* styles for any element that has class menu
including the div as I wrote above */
}

..active {
/* styles for any element that has class active
including the div as I wrote above */
}

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3
In article <n5********************************@4ax.com>,
Harlan Messinger <hm*******************@comcast.net> wrote:
I have a script that generates a hierarchical menu, but I am having problems
assigning styles to each manu items different possible states. The possible
states a menu item can be in is (and all of these can be combined unless
they
are mutually exclusive):

1. It can belong to a specific level in the hierarchy; 1, 2, 3 and so on.
2. It is the active menu
3. It is an inactive menu
4. It has children
5. It does not have children

As you see, there are quite a lot of things a specific menu can belong to,
such
as:

Menu item "Front page" may belong to level 1, be the active menu and have
children - and should have an apparence that coprrespondes to this.

Is there a way to assign multiple classes, or in any other way manage this
parrticular menus look? In pseudo-code:

<div class="menu,level1,active,haschildren">Front Page</div>


Almost--separate the class names with spaces.


Ok
And

.menu .level1 .active .haschildren { ... }


No, define the style of each class independently.


No, that won't work. I want a specific style for that exact combination of
styles.

I once saw a style declarations that looked like this:

.class < .otherclass { ... }

But I am unsure if it was CSS or perhaps XLS. I don'tknow what it did though.

--
Sandman[.net]
Jul 20 '05 #4
Sandman <mr@sandman.net> wrote:
In article <n5********************************@4ax.com>,
Harlan Messinger <hm*******************@comcast.net> wrote:
>I have a script that generates a hierarchical menu, but I am having problems
>assigning styles to each manu items different possible states. The possible
>states a menu item can be in is (and all of these can be combined unless
>they
>are mutually exclusive):
>
>1. It can belong to a specific level in the hierarchy; 1, 2, 3 and so on.
>2. It is the active menu
>3. It is an inactive menu
>4. It has children
>5. It does not have children
>
>As you see, there are quite a lot of things a specific menu can belong to,
>such
>as:
>
>Menu item "Front page" may belong to level 1, be the active menu and have
>children - and should have an apparence that coprrespondes to this.
>
>Is there a way to assign multiple classes, or in any other way manage this
>parrticular menus look? In pseudo-code:
>
> <div class="menu,level1,active,haschildren">Front Page</div>
Almost--separate the class names with spaces.


Ok
>And
>
> .menu .level1 .active .haschildren { ... }
>


No, define the style of each class independently.


No, that won't work. I want a specific style for that exact combination of
styles.


Oh, OK. I figured you just wanted to combine and cascade. Then remove
the spaces in your list of period-headed classes, as Brian suggested.

I once saw a style declarations that looked like this:

.class < .otherclass { ... }
There isn't any E1 < E2. There's E1 > E2, which matches any element
matching E2 that is a child (an immediate child, not a descendent) of
an element matching E1.

But I am unsure if it was CSS or perhaps XLS. I don'tknow what it did though.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #5
In article <10*************@corp.supernews.com>,
Brian <us*****@julietremblay.com.invalid> wrote:
Sandman wrote:
Is there a way to assign multiple classes, or in any other
way manage this parrticular menus look?

<div class="menu,level1,active,haschildren">Front Page</div>


<div class="menu level1 active haschildren">Front Page</div>

.menu .level1 .active .haschildren { ... }


.menu.level1.active.haschildren {
/* styles only for element that has _all_
of these classes */
}

.menu {
/* styles for any element that has class menu
including the div as I wrote above */
}

.active {
/* styles for any element that has class active
including the div as I wrote above */
}


Yes, this seems to work - in Safari for Mac, but not for IE for PC... What are
the limitations of IE regarding this and can I work around them somehow and
reach the same result?

--
Sandman[.net]
Jul 20 '05 #6
In article <75********************************@4ax.com>,
Harlan Messinger <hm*******************@comcast.net> wrote:
I once saw a style declarations that looked like this:

.class < .otherclass { ... }


There isn't any E1 < E2. There's E1 > E2, which matches any element
matching E2 that is a child (an immediate child, not a descendent) of
an element matching E1.


Ok, could you elaborate? How do I use it and what are the rules for it - maybe
you have a good reference URL for this.

--
Sandman[.net]
Jul 20 '05 #7
Sandman <mr@sandman.net> wrote:
In article <75********************************@4ax.com>,
Harlan Messinger <hm*******************@comcast.net> wrote:
>I once saw a style declarations that looked like this:
>
> .class < .otherclass { ... }


There isn't any E1 < E2. There's E1 > E2, which matches any element
matching E2 that is a child (an immediate child, not a descendent) of
an element matching E1.


Ok, could you elaborate? How do I use it and what are the rules for it - maybe
you have a good reference URL for this.


??? You use it as in your example above, except with > instead of <,
and I already explained what it means. Everything about CSS selectors
is explained at

http://www.w3.org/TR/CSS2/selector.html

See section 5.1, Pattern Matching, on that page. But as I also said,
this is inapplicable to what you wanted to do: use multiple classes
for the same HTML element.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #8

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

Similar topics

2
by: Thomas Hermann | last post by:
A newbie question: With the config mentioned in the topic, all on localhost, Win xpsp2, i created a caledar-table. The output should be a daily calendar for half a year with about 15 cols. ...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
7
by: Ron Goral | last post by:
Hello I am new to creating objects in javascript, so please no flames about my coding style. =) I am trying to create an object that will represent a "div" element as a menu. I have written...
4
by: allan.mcrae | last post by:
As part of a very simple memory leak detector, I am trying to store the value of __FILE__ in a char*. Since gcc4.2 I get the following warning... warning: deprecated conversion from string...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.