Is there some way to visualize whitespaces in text using only CSS without altering the original HTML code? Lets say the HTML is:
<div class="paragraph">Lorem ipsum dolor sit amet,<br/>consectetur adipiscing elit.</div><div class="paragraph">In augue ipsum, iaculis vel dapibus ut, viverra ut tellus. In ornare euismod leo a ultrices.</div>
:after
:after
<span class='space' />
and the use :after
The last one does not fulfill the condition to use only CSS and original HTML. Is there some way to do that?
EDIT: as requested, here is CSS for the pilcrow sign after the paragarph: .paragraph:after { content: "¶"; }
HTML Paragraph (<p>) Tag With <p>, browsers will add some extra whitespace with this line break to make consecutive paragraphs more readable, so it can be used any time you're using blocks of text that are distinct from each other.
pre-line. Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks.
In Visual Studio for Windows, to display whitespace characters (tabs, spaces, etc) you simply press Ctrl + R, Ctrl + W.
pre-wrap: When the white-space property of CSS is set to a pre-line value, every sequence of white-spaces will appear as it is. The content in the element will be wrapped when required and when explicitly specified.
javascript and php are probably easier, but if you insist on CSS you can use a custom web font and replace the space character (U+0020) with a glyph. Information for somewhat browser compatible css and generating custom web font
I doubt this can be achieved by CSS. It's selectors ar designed to select tags, not plain text.
I recommend you to use some script replace - server or client side. You can try to use PHP preg_replace or JavaScript replace functions.
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