我应该直接将样式应用于< html>标签? [英] Should I apply styles directly to the <html> tag?
本文介绍了我应该直接将样式应用于< html>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能存在重复:
可以设置< html>标记?
正确将CSS属性设置为html标记?
它是有效的还是可以的将样式直接应用于< html>
标记?
Is it valid or ok to apply styles directly to the <html>
tag?
示例:
<html class="myclass">
示例2:
Example 2:
<html style="background-color: #000000;">
我认为答案是否定的,但我希望得到社区的确认。
I think the answer is no, but I would like a solid confirmation from the community.
推荐答案
是的,将样式应用于< html>
元素。我经常用它来应用整页背景渐变:
Yes, it's both valid and okay to apply styles to the <html>
element. I often use it to apply full-page background gradients:
html {
background-image: linear-gradient(45deg, #eee, #ddd);
}
或者让一个元素占据整个可用高度:
Or make an element take up the entire available height:
html, body, #element {
min-height: 100%;
}
仅适用于< body>
元素,这种事情不起作用。而且,当然,不要使用内联样式。
When applied to only the <body>
element, this kind of thing doesn't work. And, of course, don't use inline styles.
这篇关于我应该直接将样式应用于< html>标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文