I have this code:
.pt_t {
font-family: arial;
font-size: 20px;
color: black;
float: left;
display: block;
}
.pt_p {
font-family: arial;
font-size: 40px;
color: black;
float: left;
display: block;
}
<span class="pt_p">1. Line</span>
<br>
<span class="pt_t">2. Line</span>
<br>
<span class="pt_t">3. Line</span>
<span class="pt_t">is</span>
<span class="pt_t">here</span>
The first span and the second span should be in two lines, the third, fourth and fifth span in the same line.
Why my code dont work?
5
Answers
You can simple remove float : left; Like :
<br>
tag works if you write in one tag onlyFor example
Also you can set
display:flex
flex-flow:column
to the parent (body) to show it as columnBy setting
float: left;
on each span you are basically bypassing<br>
. With float, the element is removed from the normal flow of the page and placed on the left/right side of its container (body
in this case), allowing other text to wrap around it.Just remove it:
A bad solution, if you really need
float: left;
, is just to addclear: both;
to br:if you need
float: left
usedisplay: grid
: