Inline CSS uses the style attribute to apply CSS to a single HTML element.
Example:
<!DOCTYPE html> <html> <body> <h1 style="color:crimson;font-family:cursive;">Hello World!!</h1> </body> </html>
Explanation:
In the above example, we used the style attribute to add CSS to a single HTML element.
Disadvantages of Inline CSS:
- Within the inline CSS, quotations can be used, because the browser will interpret this as an end of the style value.
- The inline CSS cannot be reused anywhere else.
- The inline CSS can not be stored in a single place and so the styles are tough to be edited.
- Styling of the pseudo-codes and pseudo-classes is not possible with inline CSS.
- Browser cache advantages are not facilitated by Inline CSS.