Type a few lines into a content region, look at the source, and you'll find each one inside a
<p> tag. People ask me about this a lot. It's on purpose, and here's why.
In a block region, such as a <div>, <section>, or
<td>, every piece of text lives inside a block element. When you press
Enter, the editor starts a new paragraph. When a region has loose text in it, the editor wraps
that text in a paragraph. So this:
<div id="hours" class="cms-editable">
Open every day from 7 to 3.
</div>
becomes this once someone edits it:
<div id="hours" class="cms-editable">
<p>Open every day from 7 to 3.</p>
</div>
The usual request is to drop the paragraphs and put a <br> between lines instead. I
understand why. Paragraphs add space you didn't design for, and a region full of
<p> tags looks heavier than the plain text you started with. But line breaks would make
the editor worse at almost everything it does.
Formatting needs something to hold on to
Most of the editor's tools work on a block. When you center a line, the editor puts
text-align on the paragraph you're in. When you turn a line into a heading, it changes
that paragraph into an <h2>. Lists, quotes, and styles work the same way. They all need
to know where the current block starts and ends.
A paragraph has clear edges. A line of text between two <br> tags doesn't.
There's no element there to align or to turn into a heading, only text and the breaks around it.
text-align has no effect on inline content, so centering one line would mean centering the
whole region, or wrapping that line in a new element on the fly and hoping nothing else depends on it.
Wrapping lines in <div> tags instead doesn't help much. Your templates are full of
divs that hold the layout together, and many of them are regions, repeatables, or lockables. If the editor
used divs as paragraphs, it couldn't tell which ones are your structure and which ones are just lines
of text. A paragraph is only ever a paragraph, so the editor can change it without touching anything else.
The markup says what the content is
A <p> tag tells browsers, search engines, and screen readers that this is a paragraph.
Screen readers can move from one paragraph to the next, reader modes know what to keep, and your
stylesheet can target paragraphs without guessing. A <br> only means "start a new
line here," and nothing can tell a line from a paragraph.
Paragraphs also match how content arrives. Text pasted from Word, Google Docs, or another website comes in as paragraphs. Keeping it that way keeps the code clean and the editor predictable.
None of this is new. Adrian Sutton made the same case from an editor developer's side in 2010 in Why P Tags Are Your Friends. It's still worth reading.
When you only want a line break
Press Shift + Enter. The editor inserts a <br> and keeps you in
the same paragraph. It's the right tool for addresses, poems, and anything else where lines belong
together.
<p>
123 Main Street<br>
Springfield, IL 62701
</p>
Regions that never get paragraphs
Only block regions get paragraphs. If a region should only ever hold one line, like a page title, a price,
or a phone number, make the region an inline element such as <h1>,
<p>, or <span>. Inline regions can't contain paragraphs, so the
editor won't add any.
<h1 id="title" class="cms-editable">Our Menu</h1>
<p id="hours" class="cms-editable">Open every day from 7 to 3.</p>
Inline regions also get a smaller toolbar without headings or lists, which suits short text. See content regions for the elements each type accepts.
Removing the extra space
Most of the time, the real complaint is the gap between paragraphs. That comes from your stylesheet, or the browser's default margin when your stylesheet doesn't set one, so you can fix it with CSS. To remove it from every region:
.cms-editable p {
margin: 0;
}
To keep the space between paragraphs but drop it after the last one, so a region sits flush with whatever comes next:
.cms-editable p:last-child {
margin-bottom: 0;
}
You can also target one region by its id, such as #hours p, if the rest of your site should
keep its spacing. Either way, the markup stays semantic and the page looks the way you designed it.
Spacing helps readers too
Screen readers still see paragraphs without the margin, but sighted readers lose the cue. Text without gaps runs together, which is harder to read, especially for people with low vision or dyslexia. If you remove the gap, mark paragraphs another way, such as with a first-line indent.