It's good to publish your recommendations on improving HTML - thank you :-)
There is one thing I disagree with though - and that is the use of <span></span> for text - as I don't think that this has a proper semantic meaning.
In my opinion, you should use <p>A complete block of text, also known as a sentence.</p> as the paragraph-tag has semantic meaning for text. The main issue is that many webdevs hate the default browser spacing around paragraphs. (hint: use CSS!)
For me, <span></span> is for a text fragment in some unusual non-semantic context. For example: <p>I was walking down the hill, and my feet hit a <span style='position:relative;top:-0.2em'>bump</span> that caused me to stumble.</p>. In this example, the complete sentence is enclosed in paragraph-tags showing that it make a semantic whole, and the span-tag is just used for visual effect (no semantic meaning).
One of the historic issues with HTML is the over-focus on appearance, and the low priority given to semantics.
Just my $0.02 - thank you for the article, it is good to improve the world's HTML :-)
A text fragment hasn't limits on words. Thus we can use the span for any text. The p is paragraph. The problem is we don't have single opinion what a paragraph is. I think a paragraph is sequence of text blocks that are united by one meaning.
When we do our HTML code reviews, we count the non-semantic tags like <span> - they are are considered a code-smell - that indicates something might be going wrong...
The fact that you say the span isn't semantic element is the span is semantic element because if it don't have semantic (meaning) you can't do it. And just read specs
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's good to publish your recommendations on improving HTML - thank you :-)
There is one thing I disagree with though - and that is the use of
<span></span>
for text - as I don't think that this has a proper semantic meaning.In my opinion, you should use
<p>A complete block of text, also known as a sentence.</p>
as the paragraph-tag has semantic meaning for text. The main issue is that many webdevs hate the default browser spacing around paragraphs. (hint: use CSS!)For me,
<span></span>
is for a text fragment in some unusual non-semantic context. For example:<p>I was walking down the hill, and my feet hit a <span style='position:relative;top:-0.2em'>bump</span> that caused me to stumble.</p>
. In this example, the complete sentence is enclosed in paragraph-tags showing that it make a semantic whole, and the span-tag is just used for visual effect (no semantic meaning).One of the historic issues with HTML is the over-focus on appearance, and the low priority given to semantics.
Just my $0.02 - thank you for the article, it is good to improve the world's HTML :-)
A text fragment hasn't limits on words. Thus we can use the
span
for any text. Thep
is paragraph. The problem is we don't have single opinion what a paragraph is. I think a paragraph is sequence of text blocks that are united by one meaning.I mostly agree with you.
I think there is an even higher zeroth law for HTML goodness, which is something like:
Always use accurate SEMANTIC HTML wherever possible
This article explains it better than I can: w3schools.com/html/html5_semantic_...
When we do our HTML code reviews, we count the non-semantic tags like
<span>
- they are are considered a code-smell - that indicates something might be going wrong...Semantic-HTML is good for the soul. Namaste.
The
span
is the same semantic element like otherNo its not :-)
Check the w3schools intro to semantics - right at the top, around the 3rd line...
is a non-semantic element.
The fact that you say the
span
isn't semantic element is thespan
is semantic element because if it don't have semantic (meaning) you can't do it. And just read specs