Can Paragraph Tags Be One Sentence Long?
Solution 1:
First of all, if the "why?" of this question is "SEO & semantic HTML", it worths noting that in this particular case (as well as in many others), it absolutely doesn't matter what tag to use.
Not every single thing has a semantic meaning in the markup.
It's a good idea to use <footer>...</footer>
over generic <div>...</div>
for footer, but in case of text elements the most important thing is probably to clearly differentiate "text" with "headings".
By the way, if you lookup the definition of paragraph, it specify only 2 particular limitations of paragraphs
- It is some text ( good one to follow & not use
<p>
as container for<div>
s or<img>
s ). - "A paragraph begins on a new line" ( easy to follow in web environment, since different place on the page is pretty much as a "new line" in a book ).
The rest are just general observations.
It says "it is usually more than one sentence" & "there is often a blank line between paragraphs", but technically you might write two 1-word paragraphs that are separated by a " | " instead of a blank line.
Which also follows paragraph specs.
As for <span>
& <div>
, according to specs they should be used for the same purpose (document structuring) with a difference that <div>
is a block-level element while the <span>
is an inline element.
So <span>
s are basically inlined <div>
s.
In your example site, I'd say that "Professional robust HDMI fiber extender for 4K video" is an <h2>
or <h3>
considering the name of e-store is an <h1>
somewhere in the <nav>
(it's a common practice as far as I know).
The "HDMI 2.0 | 2160p60 | 18Gbps | HDR | 4:4:4 | HDCP 2.2" should most probably be <p>
(or an <h4>
/<h5>
if it's really important).
The "sections" of this element might or might not be wrapped in <span>
s depending on whether you need it for styling or other purposes.
Solution 2:
You should not be worried unless you want to style it then use span. If not it should be in heading three or paragraph depending on what you want.
Solution 3:
Question: Can paragraph tags be one sentence long?
Yes, <p>
tags can be one sentence long—just like paragraphs in the English language can be one sentence long. One of the examples used on the <p>: Paragraph Element
page of the MDN Web Docs uses a single-sentence paragraph as an example:
<p>Some species live in houses where they hunt insects attracted by artificial light.</p>
Question: Take for example this webpage. What tags would make more sense semantically for the elements "Professional Robust HDMI fiber extender for 4k video" and "HDMI 2.0 | 2160p60 | 18Gbps | HDR | 4:4:4 | HDCP 2.2"? Would you use a span, a div, or a heading for the first sentence?
If I were writing the webpage as a text document, what would make the most sense for the main heading of the document? And in the case of an h1: what is the subject of the page? In this case, I would say that "HXT2: Professional robust HDMI fiber extender for 4K video" makes the most sense as the h1, as that is the subject of the page. The alt
text of the image HXT2 image acts as text, so you could mark that up this way:
<h1><imgsrc="HXT2.jpg"alt="HXT²"> Professional robust HDMI fiber extender for 4K video</h1>
The following run of text ("HDMI 2.0 | 2160p60 | 18Gbps | HDR | 4:4:4 | HDCP 2.2") is really a list of meta information, which could be semantically marked up as the unordered list that it is:
<ul><li>HDMI 2.0</li><li>2160p60</li><li>18Gbps</li><li>HDR</li><li>4:4:4</li><li>HDCP 2.2</li></ul>
Question: If I use a span, wouldn't that indicate to search engines and screen readers that this isn't text?
No. While <span>
elements don't have any special semantic meaning of their own, they don't remove the inherent semantics of text. Text wrapped in a <span>
is still text, and it has no inherent affect on the way that search engines or screen readers interpret it.
Post a Comment for "Can Paragraph Tags Be One Sentence Long?"