I want to add some prewritten pieces of text in my code but I don't want to get stuck with pre tags. How can I do it with CSS?
I am really sorry if anyone has asked this question before. The search doesn't work for me today :(((
Well, <pre> elements are just block elements preserving spaces. The first thing is you should add a selector to that "pieces of text", I'd prefer a class for that. Then style it with "white-space" and "display" property like so:
You can also use monospace font, if you want to 😂.
the <pre> (stand for preformated) tag has css rule 'white-space:pre;' by default... wich is the property you need to mimic its behavior of not collapsing spaces, tabs and new lines.
Another useful value for this property is 'pre-wrap' (same behavior -- keeping spaces -- but allowed to wrap).