Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Which inline attribute is used to specify the styling of specific elements in HTML ?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

In this article, we will discuss the inline attribute used to specify the styling of specific elements in HTMl. 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.  

Inline Style: In Inline styling, the CSS rules are directly written inside the starting tag using the style attribute. The style attribute includes a series of CSS property and value pairs. Each ‘ property: value ‘ pair is separated by a semicolon ( ; ). 

Let’s understand the style attribute using examples:

Example 1:

HTML




<!DOCTYPE html>
<html>
<body>
    <h1 style="color:Blue;font-size:25px;">
        Java - Inline style
    </h1>
    <p style="color:red;">Java - paragraph</p>
  
    <p style="color:green;font-size:40px;">
        python - paragraph
    </p>
  
    <hr style="border-color:orange;">
</body>
</html>


Output:

Example 2:

HTML




<!DOCTYPE html>
<html>
<body>
  
    <h1 style="color:Blue;font-size:25px;">
        Java - Inline style
    </h1>
   <h2 style="color:green;font-size:15px;">
        Python - Inline style
    </h2>
</body>
</html>


Output:


My Personal Notes arrow_drop_up
Last Updated : 01 Feb, 2022
Like Article
Save Article
Similar Reads
Related Tutorials