style

style 全局属性 包含要应用于元素的 CSS 样式声明。请注意,建议在单独的文件中定义样式。该属性和 <style> 元素的主要目的是允许快速样式化,例如用于测试目的。

¥The style global attribute contains CSS styling declarations to be applied to the element. Note that it is recommended for styles to be defined in a separate file or files. This attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes.

Try it

注意:该属性不得用于传达语义信息。即使删除所有样式,页面在语义上也应保持正确。通常它不应该被用来隐藏不相关的信息;这应该使用 hidden 属性来完成。

¥Note: This attribute must not be used to convey semantic information. Even if all styling is removed, a page should remain semantically correct. Typically it shouldn't be used to hide irrelevant information; this should be done using the hidden attribute.

规范

Specification
HTML Standard
# the-style-attribute

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also

全部 全局属性

¥All global attributes.