开发者

Is it OK to style the <html> tag?

开发者 https://www.devze.com 2023-02-23 14:14 出处:网络
Sometimes you want two body backgrounds. One for the header and one for the footer. I accidentally discovered that it is possible to style the actual 开发者_C百科<html> tag.

Sometimes you want two body backgrounds. One for the header and one for the footer. I accidentally discovered that it is possible to style the actual 开发者_C百科<html> tag.

HTML:

<html xmlns="http://www.w3.org/1999/xhtml">

CSS:

html {background:#000}

Is it OK to style this, or will it cause any problem?


Although it's debatable as to whether it's valid [see here]:

For HTML documents, however, we recommend that authors specify the background for the BODY element rather than the HTML element. ...

Many large sites still use it with seemingly consistent results.


Yes, it's OK to style the html tag.


It is very common practice. Used all the time on many websites including this one.

0

精彩评论

暂无评论...
验证码 换一张
取 消