WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a page in called "mypage".
Then I created a custom template page called "page_mypage.php".

Now, I just wanted to create some custom CSS classes in style.css. I tried with:

div.page-mypage-php #myclass{}

but I get no results. What's the correct way of doing this?

share|improve this question

The styles are not created in CSS, they are created in page markup.

If your theme and template are coded properly they make use of body_class() function, that will output number of classes for you to make use of in page source.

View source of your page and <body> tag to see what you have available and can target in CSS for your page.

share|improve this answer
i have understood almost nothing... :( – barbara Mar 23 '12 at 15:36
@barbara if you need help with CSS concepts in general, this is not the site to ask on. I have trouble figuring out how else to answer because I don't have clear idea what is going on in your template and CSS. – Rarst Mar 23 '12 at 16:11
ok thanks anyway – barbara Mar 23 '12 at 17:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.