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.


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>
      <title>HTML Inline CSS</title>

      <h1 style=”font-size: 20px;”>
      <p>We have tutorials on Programming, CMS, Scripting Languages, etc.</p>
Updated on 15-Jun-2020 08:29:10