I have seen it a lot in css talk. What does semantically correct mean?
See Question&Answers more detail:osI have seen it a lot in css talk. What does semantically correct mean?
See Question&Answers more detail:osIt means that you're calling something what it actually is. The classic example is that if something is a table
, it should contain rows and columns of data. To use that for layout is semantically incorrect - you're saying "this is a table" when it's not.
Another example: a list (<ul>
or <ol>
) should generally be used to group similar items (<li>
). You could use a div
for the group and a <span>
for each item, and style each span
to be on a separate line with a bullet point, and it might look the way you want. But "this is a list" conveys more information.
HTML stands for "HyperText Markup Language"; its purpose is to mark up, or label, your content. The more accurately you mark it up, the better. New elements are being introduced in HTML5 to more accurately label common web page parts, such as headers and footers.
All of this semantic labeling helps machines parse your content, which helps users. For instance:
fieldsets
with one legend
for each one. A blind user can hear the legend
text and decide, "oh, I can skip this section," just as a sighted user might do by reading it.type="tel"
(for telephone numbers).