I want to add a blank space after some content, however the content: " ";
doesn't seem to work.
This is my code:
h2:after { content: " "; }
... which doesn't work, however this does:
h2:after { content: "-"; }
What am I doing wrong?
In most cases, you should be able to use the normal space character ( or \20 ) to add space before or after an element using the content property with ::before or ::after pseudo-elements.
To create extra spaces before, after, or in-between your text, use the (non-breaking space) extended HTML character. For example, with the phrasing "extra space" using a double space, we have the following code in our HTML.
In case you want additional space ( more than the default ) between div rows then you can add the following code before/after the start of the div row depending on where you want the additional space. This is easier but will add a fixed amount of gap.
To insert blank spaces in text in HTML, type for each space to add. For example, to create five blank spaces between two words, type the entity five times between the words. You do not need to type any spaces between the entities.
Turns out it needs to be specified via escaped unicode. This question is related and contains the answer.
The solution:
h2:after { content: "\00a0"; }
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