Quote:
Originally Posted by hobnail
I was using that but it's too big of a hammer, even for me. There are times when I want an indent but the previous thing isn't a p, for example, a figure, or a div around whatever, or a blockquote. So now I use
Code:
dl + p,
hr + p,
header + p,
p:first-child {
margin-top: 1.0em;
text-indent: 0em;
}
body p {
margin: 0;
padding: 0;
text-indent: 2em;
}
(I like big fat indents.)
In other words, only specify where you don't want an indent. Also, the logic this way is clearer; saying "no indent for p, but then indent a p when it's after a p" can be confusing for someone looking at your css. With coding/programming it's usually better to make things clear and avoid clever tricks that could be misunderstood or hard to understand.
|
IMHO, it's easier to do the following...
Code:
p {
margin-top: 0;
margin-bottom: 0;
text-indent: 1.2em;
}
.noindent {
text-indent: 0;
}
Then you don't have to figure out all the stuff that can come before an indented p as all you'll need is <p class="noindent">. Problem solved. Plus, it's easier to read the HTML code.