HTML style attribute. Styles in HTML are basically rules that describe how a document will be presented in a browser. Style information can be either attached as a separate document or embedded in the HTML document.
There are 3 ways of implementing style in HTML :
- Inline Style : In this method, the style attribute is used inside the HTML start tag.
- Embedded Style : In this method, the style element is used inside the <head> element of the document.
- External Style Sheet : In this method the <link> element is used to point to an external CSS file.
Inline Style :
In this method, the style attribute is used inside the HTML start tag. The style attribute includes a series of CSS property and value pairs. Each ‘ property : value ‘ pair is separated by a semicolon ( ; ).
Embedded Style :
Embedded or internal style sheets only affect the document they are embedded in. Embedded style sheets are defined in the <head> section of an HTML document using the <style> tag.
External Style Sheet:
External Style Sheets method can be useful when the CSS has to be applied to various web pages. An external style sheet holds all the style rules in a separate document that you can link from an HTML file on your site.