|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
I have decided to use a Tab Style CSS menu for one of my new designs. For this to work, I need to have a class set in the body like this:
Code:
<body class="section-1"> Code:
<body class="section-2"> However, I am also using a generic header and footer include for the template (ie: for the whole site). This has become tricky because depending on which page is being displayed (specifically which directory it's in), the body class needs to be different. So, is there any way that I can move that class, ie: Code:
<body class="section-1"> I can create the site so that the content that each tab link leads to is in a different directory, so if I can dynamically assign a stylesheet to a page (depending on which directory it is in) ..and put that class IN the stylesheet ..all will be cool. ..anyone? MrLeN
__________________
TubeShine - YouTube Playlist Generator |
|
||||
|
I really don't understand this problem. Maybe I just need more coffee before I wrap my brain around it. If you have the class identitifed in the body tag, and both classes are defined in the CSS, the appropriate class is used. If you are changing something further into the page based on the body class, you can always use a descendant selector for that class, like this:
body.section-1 .tab1 {styleinfo...} body.section-2 .tab1 {styleinfo...} Anything of class "tab1" will get different styling depending on what body class is in use on that page. I did read two articles at A List Apart dealing with tabbed navigation using CSS. I don't know if it's relevant to what you're doing or not, but these are the articles: Sliding Doors of CSS by Douglas Bowman Sliding Doors of CSS, Part II by Douglas Bowman |
|
||||
|
Quote:
..so what I want to do is move that class to a stylesheet and have more than one stylesheet. ie: each stylesheet will have the different class. Having done that, the class will be used simply by having the appropriate stylesheet in the directory that the page is in. Hmm.. I know I explain things all messed up. It's a bad habit that I can't seem to fix! ===========I'll start again.. The simple version of what I want: I want to take the class out of: Code:
<body class="section-1"> MrLeN
__________________
TubeShine - YouTube Playlist Generator |
|
||||
|
Quote:
Thanks! :D ..will do perfectly! MrLeN
__________________
TubeShine - YouTube Playlist Generator |
|
|||
|
Since you are using PHP why not use PHP to change the body tag dependant on the current URL.
Code:
if (REQUEST_URI='foo.html') print"<body class=\"section-1\">";
__________________
Carbonize |
|
||||
|
..oh, but how can I take this out of the body and put it in the stylesheet?:
Code:
<body class="section-1"> Code:
body {
??? section-1 ???
}
__________________
TubeShine - YouTube Playlist Generator |
|
||||
|
Quote:
..but I would have to have a LOT of if's wouldn't I? ..what happens if I have 10,000 pages? ..can I do it with a directory instead of a page? MrLeN
__________________
TubeShine - YouTube Playlist Generator |
|
||||
|
Quote:
What I would do is have PHP echo out a <div class="section-x">(x represending your page) and </div> encapsulating your output then in your style you would give section-x each different styles. That's how I would do it. Infact that IS how I do it. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |