CSS end of line character
Asked Answered
C

3

7

Okay, what I want is this: When the <p> tag ends with </p>, I want to add a character at the end of the line. For example

<p>Something and more!</p>

Should look like

Something and more!_

Where the '_' (underscore) is the added character.
Is this possible with CSS?
Is it also possible at the end of a line?

Constantino answered 1/11, 2011 at 20:3 Comment(3)
Why don't you add a padding-bottom: 15px (or whatever your line height is) to the <p> tag's css?Ichnography
There is no line (and no spoon). There are only boxes in HTML and CSS.Honaker
@janoliver: Maybe 1em would be better?Anthodium
S
5

Yes it is possible

p:after{
    content:"_";
}
Scriabin answered 1/11, 2011 at 20:9 Comment(0)
U
4

If I've understood your question right, then I think the following works as you require:

p:after {
    content: '_';
}

JS Fiddle demo.

Which seems compatible even with IE 8 and above.

Unearned answered 1/11, 2011 at 20:7 Comment(1)
I...don't know. Updated it, though. Thanks for the catch, and the notification.Unearned
O
2

You can use the pseudo-class :after:

p:after { content: '_'; }

It’s not possible for each line though, as CSS practically does not know about “lines”.

Oarfish answered 1/11, 2011 at 20:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.