By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,648 Members | 1,199 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,648 IT Pros & Developers. It's quick & easy.

CSS: Any way to inherit or duplicate this class?

P: 2
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
Share this Question
Share on Google+
3 Replies


drhowarddrfine
Expert 5K+
P: 7,435
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

P: 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
Expert 5K+
P: 7,435
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

Post your reply

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