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

CSS: Any way to inherit or duplicate this class?

I've just written a CSS/HTML flyout menu as an addition to an existing system (EQdkp Plus, to be specific). The menu is generated by a couple PHP functions. The output is an unordered list as in this pseudocode:
Expand|Select|Wrap|Line Numbers
  1. <div class="menu">
  2. <ul>
  3.   <li>Entry
  4.     <ul>
  5.       <li>Submenu Entry</li>
  6.     </ul>
  7.   </li>
  8. </ul>
  9. </div>
I want to add submenu headings to my list, which is quite simple:
Expand|Select|Wrap|Line Numbers
  1. stuff
  2. <li class="menuheading">Submenu Heading</li>
  3. <li>Submenu Entry</li>
  4. stuff
However, I want to make the headings have the same visual style as the style template that's currently in use by the system. This is where my problem lies. Every style template defines its menu headings like this:
Expand|Select|Wrap|Line Numbers
  1. th.smalltitle {
  2.   font-weight: something;
  3.   color: something;
  4.   background-color: something;
  5.   more stuff
  6. }
I wish it was just .smalltitle instead of th.smalltitle; then I'd be able to simply write <li class="menuheading smalltitle">. And due to some limitations with both the system and HTML/CSS, I cannot use tables inside the menu. So, I need some way to inherit or copy the smalltitle class, like saying
Expand|Select|Wrap|Line Numbers
  1. li.menuheading inherits th.smalltitle
Is there any way to do this?
Jan 20 '08 #1
3 7473
drhowarddrfine
7,435 Expert 4TB
I guess you are saying you don't have access to the CSS file? Otherwise you could just do:
.menuheading, th.menuheading{
the css
}

Or, do inline styling:
<li style="css stuff">
Jan 21 '08 #2
I guess you are saying you don't have access to the CSS file? Otherwise you could just do:
.menuheading, th.menuheading{
the css
}

Or, do inline styling:
<li style="css stuff">
Right. I want to make the style match the one defined in the current style's CSS. There may be any number of styles and they're based on a CSS template that I can't change, which has the th.smalltitle block that I mentioned. Suppose I don't know what values are used, just the names of the attributes that are set.
Jan 21 '08 #3
drhowarddrfine
7,435 Expert 4TB
Then I can't think of any way to do it. Perhaps javascript could read the values and change them using the DOM, but that's javascript
Jan 21 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: David Beardsley | last post by:
Is there no way to refer to an existing rule to set a value for a new rule short of generating a style sheet server side? For example: div.a {color: blue;} div.b {color: div.a.color} ...
2
by: Nathan | last post by:
We have a content management system which allows our users to enter html into pages on the site but they often just paste in from Word and fill the site with word and html tags. Our content...
6
by: Luke | last post by:
Hi, Is it possible to do this... ..MyStyle{ color: White; font-family: Verdana; font-size: 10px; background-color: Blue;
7
by: Steven (remove wax and invalid for reply) | last post by:
I'm moving an old page to a new host, and trying to modernize it at the same time. There are two little problems that are driving me nuts. 1. Validation of www.marzolian.com/index.html says: ...
7
by: Frank | last post by:
Hi, a question probably asked before, but I can't find the answers. Base class X, classes A, B and C inherit class X. In class A I do not want to inherit property (or function or method) P1....
4
by: bissatch | last post by:
Hi, I would like to be able to create a CSS class that has all the same property values as another class but additional ones too. Instead of having to rewrite the same property values again, can...
5
by: Ikke | last post by:
Hi everybody, Here's a little problem that's been bothering me. I have a stylesheet, in which I define the looks of a table on my website. Each alternating row gets a different color, as is...
32
by: Simon Dean | last post by:
Duh... Not another one... Hopefully simple though, I hate the way *I* (and it might be a CSS trait) can't intermix fixed width divisional elements with a variable auto expanding div??? The...
27
by: GloStix | last post by:
WARNING VIDEO TAKES A WHILE TO LOAD http://screencast.com/t/BWQ6DNtsM I really don't know how to fix this other than putting another div. But I dont' exactly want to do that for every page....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.