Assuming I have a list:
What is the correct way to achieve this in HTML/CSS:
Item One
Item Two is really long. As a matter of fact, it's made up of a couple different paragraphs.
I'd really like to be able to have a break between the second and third sentence because otherwise it gets all bunched together and is really difficult to read.
Item Three
It seems some options are <p>
, <div>
, and perhaps <span>
with the appropriate display
style. There are probably even more options, but I am hoping there is a correct / recommended approach.
For the sake of scoping this question, let's assume modern browsers that support HTML5/CSS3.
Edit: For people voting to close the question, could you leave a comment as to why? If there's some obvious guideline I should follow, please link to it. Given that there are often multiple ways to accomplish things in HTML/CSS, I think it's fair to ask if there is a "correct" way.
The \n character matches newline characters.
Just use margin-top: 1em; that will give a white space of one line above your tag .
With <p> and <blockquote> tags, a single blank line appears before and after the enclosed indented text block. When <br /> tags are inserted to end lines of text, no spacing appears between the lines.
<p>
stands for paragraph, so this would be the recommended way, but, all the other ways are valid as well.
<span>
is not recommended as it's not a block element.
You can use <br>
to breakline:
<ul>
<li>
Item One
</li>
<li>
Item Two is really long. As a matter of fact, it's made up of a couple different paragraphs.
<br><br>I'd really like to be able to have a break between the second and third sentence because otherwise it gets all bunched together and is really difficult to read.
</li>
<li>
Item Three
</li>
</ul>
You can as well us an empty block
element and set a size to it using CSS:
.spacer {
height: 10px;
}
Item Two is really long. As a matter of fact, it's made up of a couple different paragraphs.
<div class="spacer"></div>I'd really like to be able to have a break between the second and third sentence because otherwise it gets all bunched together and is really difficult to read.
Or a <p>
tag:
<p>Item Two is really long. As a matter of fact, it's made up of a couple different paragraphs.</p>
<p>I'd really like to be able to have a break between the second and third sentence because otherwise it gets all bunched together and is really difficult to read.</p>
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