View Single Post
Old 04-06-2022, 09:58 AM   #11
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 80,071
Karma: 147983159
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by hobnail View Post
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.
JSWolf is online now   Reply With Quote