If at the start of my html5 doc I simply use:
<!DOCTYPE html><html>
how will my site be at a disadvantage for not using something like:
<!DOCTYPE html><html lang="en">
The lang attribute is an essential component in the basic structure of an HTML document. It's important that we define it correctly because it affects many aspects of user experience. Unfortunately, the negative effects a missing or wrong attribute can have aren't always evident.
The lang global attribute helps define the language of an element: the language that non-editable elements are written in, or the language that the editable elements should be written in by the user.
<html> element does not have a [lang] attribute If a page doesn't specify a language for the <html> element, a screen reader assumes the page is in the default language that the user chose when setting up the screen reader, often making it impossible to understand the content.
In a nutshellAlways add a lang attribute to the html tag to set the default language of your page. If this is XHTML 1. x or an HTML5 polyglot document served as XML, you should also use the xml:lang attribute (with the same value). If your page is only served as XML, just use the xml:lang attribute.
Good question, but I think most of what you want to know is simple reference:
http://www.w3.org/TR/html4/struct/dirlang.html
Some highlights:
Language information specified via the lang attribute may be used by a user agent to control rendering in a variety of ways. Some situations where author-supplied language information may be helpful include:
- Assisting search engines
- Assisting speech synthesizers
- Helping a user agent select glyph variants for high quality typography
- Helping a user agent choose a set of quotation marks
- Helping a user agent make decisions about hyphenation, ligatures, and spacing
- Assisting spell checkers and grammar checkers
I don't believe there are any important differences between HTML4 and HTML5 regarding this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With