style
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
尝试一下
<div style="background: #ffe7e8; border: 2px solid #e66465">
<p style="margin: 15px; line-height: 1.5; text-align: center">
Well, I am the slime from your video<br />
Oozin' along on your livin' room floor.
</p>
</div>
备注:
这个属性不能用于传递语义信息。即使所有样式都移除了,页面也应该保留正确语义。通常它不应用于隐藏不相关的信息;这应该使用 hidden
属性来实现。
规范
Specification |
---|
HTML # the-style-attribute |
CSS Style Attributes # style-attribute |
浏览器兼容性
BCD tables only load in the browser