English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The style global attribute contains CSS style declarations applied to the element. Note that it is best to define styles in a separate file. The main purpose of this attribute and the <style> element is for quick decoration. For example, for testing purposes.
Usage notes:This attribute should not be used to pass semantic information. Even if all styles are removed, the page should retain the correct semantics. It is usually not used to hide irrelevant information; this should be done using the hidden attribute.
Using the style attribute in HTML documents:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML style attribute usage (basic tutorial website oldtoolbag.com)</title> </head> <body> <h1 style="color:blue;text-align:center">This is a header</h1> <p style="color:green">This is a paragraph.</p> </body> </html>Проверьте, чтобы узнать ‹/›
IEFirefoxOperaChromeSafari
Все основные браузеры поддерживают style атрибут
Style атрибут определяет инлайн стили элемента.
Style атрибут будет перекрывать любые глобальные стили, такие как стили,指定的 в теге <style> или во внешних таблицах стилей.
В HTML5 style атрибут может использоваться на любом HTML элементе (он будет проверен на любом HTML элементе. Но это не всегда полезно).
В HTML 4.01 style атрибут не может использоваться вместе с <base>, <head>, <html>, <meta>, <param>, <script>, <style> и <title>
<элемент style="style_definitions">
Значение | Описание |
---|---|
style_definitions | Одна или несколько CSS свойств и значений, разделенных точками с запятой. (например: style="color:blue;text-align:center") |