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.

style 全域屬性 包含要應用於此元素的 CSS 樣式宣告。請注意,建議將樣式定義在單獨的檔案中。此屬性和 <style> 元素主要目的是允許快速設定樣式,例如用於測試目的。

嘗試一下

備註: 此屬性不得用於傳達語義資訊。即使所有樣式都被移除,頁面也應該保持語義正確。通常不應該使用它來隱藏不相關的資訊;這應該使用 hidden 屬性來完成。

規範

Specification
HTML
# the-style-attribute
CSS Style Attributes
# style-attribute

瀏覽器相容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
style

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

參見