The HTML style attribute is used to apply CSS styling rules directly on element, also known as inline styling. Its generally recommended to apply styles in external files, since it will allow browsers to make use of caching, speeding up the page load, and lowering the bandwidth usage for both the visitor and the host.
The style element can be used on all styleable elements. I.e.
<p style="color:black;margin: 1em 0 2em;">Test paragraph</p>
If you are using multiple CSS properties, you should separate each property with a semicolon ";".
The style attribute will override styling globally. I.e. Styles set in external StyleSheets, and from style elements in the page.
When to use the Style Attribute
The HTML style attribute can be used when you don't have access to the CSS files, and still want to change the appearance of the elements on a page – It should however be said, that taking the time to use external StyleSheets, usually will be the better option.
It can also be useful to quickly test something directly on your site, especially if you don't have access to the CSS files, or just don't want to open up your editor.