How to use inline CSS (Style Sheet) in HTML?

HTMLWeb DevelopmentFront End Technology

To add inline CSS in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with CSS properties such as font-family, font-style, text-decoration, direction, etc.

Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.

Example

You can try the following code to use inline CSS in HTML. Here, we are adding font size to heading using inline CSS

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Inline CSS</title>
   </head>

   <body>
      <h1 style=”font-size: 20px;”>
         Tutorials
      </h1>
      <p>We have tutorials on Programming, CMS, Scripting Languages, etc.</p>
   </body>
</html>
raja
Published on 18-Jan-2018 11:13:09
Advertisements