Posts

Showing posts with the label different ways to break line by css

Add line break in css using class / injecting a line break in css

Image
Injecting a Line Break I had a little situation where I had a header with a span in it, and I wanted to make sure to put a line break before the span. For the record, there really isn't anything wrong with just chucking a  <br>  tag before it (and in fact the ability to show/hide that is very useful). But... it always feels a little weird to  have  to use HTML to achieve a layout thing. So let's take a journey. A journey in which we say "But..." a lot. < h1 class = " one " > Break right after this <!-- <br> could go here, but can we do it with CSS? --> < span > and before this </ span > </ h1 > # A block level element would do it Rather than a  <span> , we could use a  <div> , and we'll get that break just by virtue of the div being a block-level element. But we're using a span on purpose, because of the design. The text after the break should be inline...