- This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I am having an issue. Every page on my website is a different color (on purpose). But I want all of my portfolio pages to use the same CSS. Here is my current HTML code for header.php
:
Now, with my current PHP code, each page can be specified in my CSS my typing .page-pagename
, but I do not want to type out each individual page from my portfolio drop-down:
.page-showreel
.page-games
.page-illustration
.page-literature
.page-photography
.page-sculpture
Like so (for every darn CSS property). I know there has to be an easier way to do this. Is there someway I could target my portfolio li
items all in one sweep? Currently, my CSS is simply using .page-portfolio
, but a physical portfolio page does not actually exist. It is simply a place holder for whatever I have to do to make this work.
Thank you in advance. You guys have always been there for me…no matter how stupid the question.
Edit: Is it something as simple as making every li class
the same name?
I don’t understand. You’re listing a menu and then a list of classes that aren’t related to each other.
What are you trying to target here? Whole pages or just the styling the menu?
If it’s just the menu, you can do this:
.header-portfolio li { /* styles */ }
Do you have a link? Do the pages share any classnames on the body that are unique to those pages?
After adding that function to your functions.php file, when you go to any page you’ll see its parent’s slug as a class on the `
`. In your case, that class is `parent-slug-portfolio`.I went to the page and inspected it with Chrome’s Inspector and looked at all of the classes being applied to the body.
Firebug and Inspector are virtually the same for these purposes.