Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.