Can I use CSS pseudo elements ::before
and ::after
to wrap some text in brackets?
i.e.
Text
becomes:
(Text)
A CSS pseudo-element is a keyword added to a selector that lets you style a specific part of the selected element(s). For example, ::first-line can be used to change the font of the first line of a paragraph. Note: In contrast to pseudo-elements, pseudo-classes can be used to style an element based on its state.
CSS word-wrap property is used to break the long words and wrap onto the next line. This property is used to prevent overflow when an unbreakable string is too long to fit in the containing box.
Go to your CSS page and write the name of the section. For example: body, p, head, div class, etc. Put curly brackets: { } Inside of the curly brackets, state what you would like to change.
::before (:before) In CSS, ::before creates a pseudo-element that is the first child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default.
Yes you can
http://jsfiddle.net/GHL6u/
<span>text</span>
span:before {
content: '(';
}
span:after {
content: ')';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With