style

Jump to: navigation, search

style

This article is Almost Ready.


W3C Recommendation

Summary

Sets an inline style for the element.


Applies to  ?

This attribute is used to set styling in the form of CSS rules to an element.

Compatibility

Do you think this data can be improved? You can ask to add by opening an issue or make a pull request.

Desktop

FeaturesChromeFirefoxInternet ExplorerOperaSafari
Basic support
?
Yes
1.0
Yes
?
Yes
?
Yes
?
Yes
scoped
20
Yes
?
Unknown
?
none
?
none
?
none

Mobile

FeaturesAndroidFirefox MobileIE PhoneOpera MobileSafari Mobile
Basic support
?
Yes
1.0
Yes
?
Yes
?
Yes
?
Yes
scoped
?
Unknown
25.0
Yes
?
none
?
none
?
none

Examples

View live example

HTML

<!doctype html>
<title>HTML Style Attribute Usage</title>

This will be white text with a blue background if all goes well! (Not in the doc page, check out the live demo.)

Usage

While this is perfectly valid, it is *highly* recommended by the community at large that you not use inline styles. Instead it is much better to simply target the element you want in your CSS and apply rules in there.

Notes

Remarks

This attribute is not accessible through scripting. To access styles through scripting, use the style object.