Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move lang attribute from html to body #286

Closed
davidmurdoch opened this issue Jan 19, 2011 · 14 comments
Closed

Move lang attribute from html to body #286

davidmurdoch opened this issue Jan 19, 2011 · 14 comments
Labels

Comments

@davidmurdoch
Copy link

Can we move the html element's lang attribute to the body?

I don't think we need to specify the (human) language of our css and javascript resources.

<body lang="en"></body>

...should be perfectly valid.

It will DRY things up a bit and help the charset meta element to be within the first 512 bytes if a developer needs to add additional attributes to the html tag(s).

@paulirish
Copy link
Member

Just looked at the spec and surrounding documentation about @lang ...

This looks legit. I'd be happy with this one. :)

good call.

@paulirish
Copy link
Member

move @lang attribute from HTML elem to BODY. closed by 16e9b7d

thx davidmurdoch

@richardcornish
Copy link
Contributor

I know this is closed and committed, but doesn't it make sense to keep the lang attribute on the <html> element because of the <title> element? That's text people read and search engines crawl.

@paulirish
Copy link
Member

hixie's preference is for the lang to stay on the HTML tag...

reopening... :/

@paulirish
Copy link
Member

Okay it's a bit redundant but....
How about setting the lang on both <head> and <body> elems?

@richardcornish
Copy link
Contributor

It works, but wasn't the point of this fix to be more DRY? I would leave well enough alone and keep on html.

@davidmurdoch
Copy link
Author

@richardcornish: putting it on the html would make it less DRY because of the conditional comments.

Can we put it on head and body tags? Leaving it in the html tag repeats it 4 times rather than 2.

Come to think of it, Content-Language is an acceptable http-header that we may be able to set as a meta tag: <meta http-equiv="Content-Language" content="en">. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12

@richardcornish
Copy link
Contributor

@davidmurdoch There would be two instances of lang="en", but in different places. It would be easier to see it all on <html> at the top, even if it's four times instead of two. It'll depend on your CMS or template system at that point.

I like the <meta> solution because it's document centric instead of element centric. It really makes more sense to declare a language at a document level, then use the lang attribute on more granular elements. Ultimately I would chose whichever method more user agents would support at that point, and I haven't seen one method favored over the other.

@nimbupani
Copy link
Member

I prefer it on html tag than on body for same reasons Hixie mentions.

@davidmurdoch
Copy link
Author

Divya, how do you feel about using the meta tag?

@nimbupani
Copy link
Member

This is what I wrote about it when I was researching language attributes: http://nimbupani.com/declaring-languages-in-html-5.html

@nimbupani
Copy link
Member

moving lang back to html, also consistent spacing in css. closed by 2a2f1d6

@davidmurdoch
Copy link
Author

meh, things just got WET.

@paulirish
Copy link
Member

Yup. they did. But here arent any great solutions here. :/

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants