Thread: CSS Question
View Single Post
Old 11-12-2020, 12:56 AM   #27
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,105
Karma: 148951733
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
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.
You have to be very careful using something like p:first-child, as it may not work in some older versions of ADE and in that cases, will cause many people a problem. I could be misremembering. You'd have to test this with ADE 2.0.1. The problem is that ADE is what you have to work with to make sure your code works. If it doesn't work in ADE 2.0.1, then you have to find another way to do what you want.
JSWolf is offline   Reply With Quote