Wednesday, May 23, 2012

CSS Nesting Problem - Reading container information

This problem comes up from time to time when I work with CSS, here is the issue I face.

My current code is:

<div class="entry">
<blockquote><p>quoted text</p></blockquote>

In my css, I have:

.entry p {margin: 10px}
blockquote {stuff}
blockquote p {margin: 0px}

I would think the paragraph inside the blockquote would read from 'blockquote p', but instead it takes the margin: 10px from '.entry p'.

Why does it read from 'entry p' instead of 'blockquote p'?

No comments:

Post a Comment