Thread: CSS Question
View Single Post
Old 11-12-2020, 12:51 AM   #26
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,591
Karma: 14328510
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by deback View Post
You should also change the <p> for the nonindented paragraphs to something like: <p class="noindent"> and don't use the <div> line at the top. It's best to assign a class to each kind of paragraph, etc. One for indents (the common indent is 1.2em, not 2em) and one for nonindents.
My preference is to use combinators and do not use, what are to me, unnecessary classes on tags. In my stylesheet.css I have
Code:
p {
    margin: 0;
    padding: 0;
    text-indent: 2em;
}

dl + p,
hr + p,
header + p,
p:first-child,
table + p  {
    margin-top: 1.0em;
    text-indent: 0em;
}
The plus means "immediately following", so no indent after a dl, or after an hr, or after a header (I wrap h tags in header tags), or after a table, and p:first-child I think means the first one in whatever it's inside of (body, div, etc.). I do have a .noindent class but I rarely use it; most of my p tags, as well as all of the others, are naked. This also ensures consistency and I don't have to worry about having forgotten to add a class to a tag.

Last edited by hobnail; 11-12-2020 at 12:56 AM.
hobnail is offline   Reply With Quote