I need a paragraph with a space to take up space.
This fiddle shows that a space renders just the same as nothing at all:
<p class='p1'>1</p>
<p class='p1'>2</p>
<p class='p1'> </p>
<p class='p1'>4</p>
How can I achieve this effect?
I need a paragraph with a space to take up space.
This fiddle shows that a space renders just the same as nothing at all:
<p class='p1'>1</p>
<p class='p1'>2</p>
<p class='p1'> </p>
<p class='p1'>4</p>
How can I achieve this effect?
Use a non-breaking space.
<p class='p1'>1</p>
<p class='p1'>2</p>
<p class='p1'> </p>
<p class='p1'>4</p>
You can add height: 20px
to your id
https://jsfiddle.net/viethien/L2eoyxhn/
If you dont want to put height, the best way is adding
in your tag
Another way, you can add :after for #p1
#p1:after {
content: '\200b';
}
I do not think this <p id='p1'> </p>
is a good pattern, my solution is create many class with different space
p {
border: 1px solid black;
}
.space-medium {
margin-top: 50px;
}
.space-low {
margin-top: 20px;
}
<p id='p1' class="space-low">1</p>
<p id='p2' class="space-low">2</p>
<p id='p4' class="space-medium">4</p>