View Single Post
Old 07-27-2022, 08:51 AM   #5
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 734
Karma: 1077122
Join Date: Sep 2013
Device: Kobo Forma
Quote:
Originally Posted by RbnJrg View Post
I don't know if I understand you well but I think you are confusing the things a bit.

With the pseudo-element ::first-letter you can't affect the indent, because the indent is for PARAGRAPHS, while ::first-letter is for the first letter of a paragraph. So, if you want to have not indented the first paragraph after <h> tags (or <hr> tag), then you should use something like:

Code:
h1 + p, h2 + p, h3 + p, h4 + p, 
h5 + p, h6 + p, hr + p {
     text-indent: 0;
}
And, if you also want to style the first letter of the first paragraph after a <h> tag, then you should use something like:

Code:
h1 + p::first-letter, h2 + p::first-letter, 
h3 + p::first-letter, h4 + p::first-letter, 
h5 + p::first-letter, h6 + p::first-letter,
hr + p::first-letter {
     font-weight: bold;
}
I was noticing that last night. I am currently using an h1 + p, h2 + p ... class and that was doing the actual nonindenting I was seeing. I was scratching my head over why a couple of my noindentdc situations weren't indenting though they were first-lettering. It turned out that the "automatic" <h2> + p wasn't kicking in because a blockquote (and in another case, just an anchor tag) was between the heading and the paragraph. As a side benefit of that research, I had turned up pretty much what you were saying. Although the explanation I found was that text-indent doesn't apply to ::first-letter. Your comment explains why.

I was thinking of trying to get it to work with the h1 + p class (similarly to what you showed), but hadn't figured out to apply the ::first-letter to <p> instead of to a different class. I was also considering some way to use it with a p + p class. I'll have to think about his some more. Right now, I'm leaning towards h1 + p::first-letter. But, I'll have to consider the ramifications.
Thanks.

Last edited by enuddleyarbl; 07-27-2022 at 09:08 AM.
enuddleyarbl is offline   Reply With Quote