The quickest way to add Lorem Ipsum to a web page is to paste HTML from a generator, or to type an Emmet shortcut like lorem in your code editor. But filler text is more than a way to fill space. It is also a great tool for testing how your CSS handles headings, lists, long words and text that is too long to fit.
Paste HTML to test your styles
Plain paragraphs only test one part of your CSS. Real pages have headings, lists, links, quotes and tables. If you only style paragraphs, the rest can look broken when real content arrives.
A simple fix is to paste a full block of HTML into your page. Here is a small example:
<article class="post">
<h1>Lorem ipsum dolor sit amet</h1>
<p>Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipiscing elit. <a href="#">Sed do eiusmod</a> tempor incididunt.</p>
<h2>Ut enim ad minim veniam</h2>
<ul>
<li>Quis nostrud exercitation</li>
<li>Ullamco laboris nisi</li>
</ul>
<blockquote>Duis aute irure dolor in reprehenderit.</blockquote>
<table>
<tr><th>Name</th><th>Value</th></tr>
<tr><td>Lorem</td><td>Ipsum</td></tr>
</table>
</article>
You do not need to write this by hand. The HTML Lorem Ipsum generator gives you ready-made markup. On the main generator, choose the HTML format and open More options to add headings, bold and italic text, links, lists, quotes, code blocks and tables.
Once it is on the page, check:
- Spacing between headings and paragraphs.
- Bullet and number styles in lists.
- How quotes and tables look on a small screen.
- Link colors in body text.
Use Emmet in your code editor
Emmet is a set of shortcuts for writing HTML fast. It comes built into VS Code and works in many other editors too.
Emmet has a lorem shortcut. In an HTML file in VS Code, type it and press Tab (or pick it from the suggestion list).
| What you type | What you get |
|---|---|
lorem |
About 30 words of Lorem Ipsum |
lorem10 |
Exactly 10 words |
p*3>lorem |
Three paragraphs, each filled with Lorem Ipsum |
ul>li*5>lorem4 |
A list with five items, four words each |
For example, ul>li*5>lorem4 expands to something like this:
<ul>
<li>Lorem ipsum dolor sit.</li>
<li>Amet consectetur adipisicing elit.</li>
<li>Quas, voluptatum.</li>
<li>Eos, quidem voluptates.</li>
<li>Nemo, sed.</li>
</ul>
The exact words will differ each time, since Emmet picks them at random. For more editor tips, see our guide on adding Lorem Ipsum in Word, Google Docs, Figma and VS Code.
Test with exact lengths
Real content comes in all sizes. A product name might be three words or fifteen. A card title might fit nicely, or it might wrap onto three lines.
Use filler with a set length to find these problems early:
- Use an exact word count to test headings and short blurbs.
- Use an exact character count to test fields with limits, like titles or meta descriptions.
- Try the shortest and longest text you expect, not only the average.
Then watch for text that pushes buttons out of line, cards with uneven heights, or headings that wrap in odd places.
Handle long words
Long words and URLs are a classic way to break a layout. Normal text wraps at spaces. A word with no spaces may not wrap at all, so it sticks out of its box.
To test this, add a very long word to your filler text, like a long URL or a made-up word with 40 or more letters.
To fix it, use overflow-wrap:
.post {
overflow-wrap: anywhere;
}
This lets the browser break a long word at any point if it would otherwise overflow. A gentler option is overflow-wrap: break-word. Both break long words to stop overflow. The difference is in how the browser sizes boxes that shrink to fit their content, such as some flex and table layouts.
Cut off text with an ellipsis
Sometimes you want text to stay on one line and end with "…" when it is too long. This is common for card titles, file names and table cells.
You need three properties together:
.card-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
Here is what each one does:
white-space: nowrapkeeps the text on one line.overflow: hiddenhides the part that does not fit.text-overflow: ellipsisshows "…" where the text is cut.
The element also needs a limited width. A block element inside a fixed-width card works. Inside a flex layout, you may also need min-width: 0 on the flex item.
Limit text to a few lines
For card descriptions, you often want two or three lines, then an ellipsis. For that, use line clamping:
.card-text {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
This shows up to three lines and cuts off the rest with "…". Despite the -webkit- prefix, this works in all major modern browsers. A standard line-clamp property also exists, but support for it is still changing, so the prefixed version is the safer choice for now.
To test it, paste a long paragraph into the card. Then paste a short one. Make sure both look right.
Quick summary
- Paste HTML with headings, lists, quotes and tables to test all your styles, not just paragraphs.
- In VS Code, use Emmet:
lorem,lorem10,p*3>loremandul>li*5>lorem4. - Test with exact word and character counts, including very short and very long text.
- Use
overflow-wrap: anywherefor long words. - Use
white-space: nowrap,overflow: hiddenandtext-overflow: ellipsisfor one-line cuts. - Use
-webkit-line-clampfor multi-line cuts.
If you want filler text straight from your scripts, the free Loremly API can return Lorem Ipsum with no key needed.