-1

Does Google really care if I use an <h5> as a <b> tag?

What are some real-world, practical reasons I should care about semantic markup?

corysimmons
  • 7,296
  • 4
  • 57
  • 65
  • 2
    This is a duplicate? http://stackoverflow.com/questions/17272019/why-to-use-html5-semantic-tag-instead-of-div – Frank W. Jan 13 '16 at 22:26
  • 1
    Possible duplicate of [Semantic markup: Why
    instead of
    – Ben Simmons Jan 13 '16 at 23:40

1 Answers1

2

A few examples

  • Many visually impaired people rely on speech browsers to read pages back to them. These programs cannot interpret pages very well unless they are clearly explained. In other words semantic code aids accessibility Search engines need to understand what your content is about in order to rank you properly on search engines.

  • Semantic code tends to improve your placement on search engines, as it is easier for the "search engine spiders" to understand.

However, semantic code has other benefits too:

  • As you can see from the example above, semantic code is shorter and so downloads faster.

  • Semantic code makes site updates easier because you can apply design style to headings across an entire site instead of on a per page basis.

  • Semantic code is easier for people to understand too so if a new web designer picks up the code they can learn it much faster.

  • Because semantic code does not contain design elements it is possible to change the look and feel of your site without recoding all of the HTML.

  • Once again, because design is held separately from your content, semantic code allows anybody to add or edit pages without having to have a good eye for design.

  • You simply describe the content and the cascading style sheet defines what that content looks like.

Source: boagworld


Semantics and the Web

Semantics are the implied meaning of a subject, like a word or sentence. It aids how humans (and these days, machines) interpret subject matter.
On the web, HTML serves both humans and machines, suggesting the purpose of the content enclosed within an HTML tag.
Since the dawn of HTML, elements have been revised and adapted based on actual usage on the web, ideally so that authors can navigate markup with ease and create carefully structured documents, and so that machines can infer the context of the wonderful collection of data we humans can read.

Until — and perhaps even after — machines can understand language and all its nuances at the same level as a human, we need HTML to help machines understand what we mean. A computer doesn’t care if you had pizza for dinner. It likely just wants to know what on earth it should do with that information.

HTML semantics are a nuanced subject, widely debated and easily open to interpretation. Not everyone agrees on the same thing right away, and this is where problems arise.

Allow me to paint a picture:
You are busy creating a website.
You have a thought, “Oh, now I have to add an element.”
Then another thought, “I feel so guilty adding a div. Div-itis is terrible, I hear.”
Then, “I should use something else. The aside element might be appropriate.”
Three searches and five articles later, you’re fairly confident that aside is not semantically correct.
You decide on article, because at least it’s not a div.
You’ve wasted 40 minutes, with no tangible benefit to show for it.
— Divya Manian

This generated a storm of responses, both positive and negative. In Pursuing Semantic Value By Jeremy Keith argued that being semantically correct is not fruitless, and he even gave an example of how <section> can be used to adjust a document’s outline. He concludes:

But if you can get past the blustery tone and get to the kernel of the article, it’s a fairly straightforward message: don’t get too hung up on semantics to the detriment of other important facets of web development. — Jeremy Keith

Naming Things

Of all the possible new element names in HTML5, the spec is pretty set on things like <nav> and <footer>. If you’ve used either of those as a class or id in your own markup, it’s no coincidence. Studies of the web from the likes of Google and Opera (amongst others) looked at which names people were using to hint at the purpose of a part of their HTML documents. The authors of the HTML5 spec recognised that developers needed more semantic elements and looked at what classes and IDs were already being used to convey such meaning.

Of course, it isn’t possible to use all of the names researched, and of the millions of words in the English language that could have been used, it’s better to focus on a small subset that meets the demands of the web. Yet some people feel that the spec isn’t yet doing so.

Source: html5doctor (This goes on for quite a while so I've only put a few examples here.)


Hope this helps!

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Mike Donkers
  • 3,589
  • 2
  • 21
  • 34