Juanky Juanky - 10 months ago 38
CSS Question

Wordpress Page not reading css properly

My wordpress page is skipping a css class, and it doesn't show well. It has no padding.

In my wordpress theme, all the pages have the .page .hentry class inside their class attribute.

The page "Ask" has this html code:

<article id="post-70" class="post-70 page type-page status-publish hentry">...

And works ok, but my Questions page don't

<article id="post-69" class="post-69 page type-page status-publish hentry">...

When I see the code with chrome, the article has the .hentry class only.

This is part of the css code:

.hentry {
margin: 0 0 45px;
background-color: #fff;
border: 1px solid #e0e0e0;
.page .hentry {
padding: 45px;

This is the link to the page with the problem, and the other page

Answer Source

.page .hentry means that it adresses elements with class hentry inside a parent/grandparent etc. element with class .page

Look at the classes in the body tag: The one page has class page in the body, the other one archive (and no page) So the .page .hentry selector only applies to .hentry in the page that has .page in its body tag, not the archive page.

if you want to address both, you can use .page.hentry as a selector (without a space in between) - this will apply to all elements that have both .page AND .hentry classes .