Jump to content

overriding an id


michaellunsford

Recommended Posts

I've created a CSS menu inside a simple table. The page the user is currently on is supposed to be different. I can pull it off if I inline the style, but trying a different id or class keeps getting over-riden.

I'm still a bit green with CSS, so any help would be great.

basic example (the actual code figures out what page they're on and assigns the class using PHP, if there's a way to do it with CSS, that'd be awesome, too) :

[code=php:0]<table id="menubar">
<tr>
<td><a href="page2.html">page2</a></td>
<td><a href="page3.html" class="highlightme">page3</a></td>
</tr>
</table>[/code]


CSS:

[code=php:0]
#menubar a {
background-color:inherit;
text-decoration:none;
border-left:2px solid #FFF;
border-right:2px solid #FFF;
border-top:none;
border-bottom:none;
color:#066;
}
#menubar a:hover, .highlightme a {
background-color:inherit;
color:#F90;
border-left:2px solid #F90;
border-right:2px solid #F90;
border-top:none;
border-bottom:none;
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/28694-overriding-an-id/
Share on other sites

Ahhh, ok... then you would use this CSS code: [code]#menubar a {
background-color:inherit;
text-decoration:none;
border-left:2px solid #FFF;
border-right:2px solid #FFF;
border-top:none;
border-bottom:none;
color:#066;
}

#menubar a:hover, a.highlight {
background-color:inherit;
color:#F90;
border-left:2px solid #F90;
border-right:2px solid #F90;
border-top:none;
border-bottom:none;
}[/code]

Note: Please use the [nobbc][code][/nobbc]-tag instead of the [nobbc][php][/nobbc]-tag because of these reasons:
1. It is CSS code, not PHP code.
2. You cannot copy the code.
3. The [nobbc][code][/nobbc]-tag makes a box where you can scroll, that takes up less space if there is a lot of code.
Link to comment
https://forums.phpfreaks.com/topic/28694-overriding-an-id/#findComment-136753
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.