I have the following line of css and html here:
CSS:
.top, .title {
font-weight: bold;
}
.bottom, .Content {
}
HTML:
<span class='title'>Title</span>
<br/>
<span class='Content'>Content</span>
<br/><br/>
I would like to replace the <br/>
tag with an equivalent in CSS, but I am struggling with it. I would appreciate any help.
I've tried margin-bottom, margin-top, line-height, none of it worked.
There are many ways to break the line without using <br> tag. The used properties are listed below: white-space: pre; It is used to make elements acts like <pre> tag. display: block; It sets the display property of elements to block.
Styling with CSS The <br> element has a single, well-defined purpose — to create a line break in a block of text.
There is a way by which you can increase line break between lines, is by putting multiple br tags. Method-1: Use various span classes with a different style applied to them, you can change the value of “margin-bottom” for these classes to change the height of line break.
You can simulate BR tags width CSS like this:
span:after {
content: ' ';
display: block;
}
Use the selector ":before" if you need the "br" been simulated before the span content
jsfiddle
<span>
is an inline element, so can't have margin
applied, but it can take padding
- give it something like .title { padding: 10px 0; }
and it'll simulate a paragraph, or just .title { display: block; }
to force the next thing to go beneath it.
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