开发者

Is it OK to style the <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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜