Web Development Blog

Remove <br> Line Break with CSS and Replace with Space

Remove <br> Line Break with CSS and Replace with Space

Are you’re looking to replace <br> break with a space using only CSS? I’ve got a solution for you then. To do this we’ll use CSS to change the content of the br tag which will prevent it from making a line break. Then we’ll also add content using the :after pseudo-element.  That will ensure the <br> tag is replaced with a space.

Here is what that looks like. You can copy and paste this into your style sheet file or in-line CSS.

br{content:' ';}
br:after{content:' ';}

Gallagher Website Design
Gallagher Website Design

Leave a Comment

Request A Free Quote

GET OUR PRICING GUIDE

Enter your email address below, and we'll send you our current pricing guide immediately.