The Wayback Machine - https://web.archive.org/web/20240729062427/https://www.geeksforgeeks.org/which-inline-attribute-is-used-to-specify-the-styling-of-specific-elements-in-html/
Open In App

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

Last Updated : 06 Jun, 2023
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report

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: In this example, we will use style attribute for styling the HTML

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: In this example, we will style the content by using inline CSS styling.

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:



Similar Reads

Which attribute is used to specify an alternate text for an image, if the image is not loaded properly in HTML ?
In this article, we will discuss the attribute that is used to specify an alternate text for an image, if an image is not loaded properly in HTML. The &lt;img&gt; alt attribute is used to specify the alternate text for an image. It is useful when the image is not displayed. It is used to give alternative information for an image. Syntax: &lt;img al
1 min read
Which attribute is used to disabled the specific input field in HTML Form ?
HTML5 introduced many attributes that are used for developing an efficient webpage. In this article, we will learn to disable the particular input field by using the "disable" attribute with the specific type of input. The disabled attribute is a boolean attribute that is used to vandalize the input field. A disabled input is un-clickable and unusa
1 min read
Which property is used as shorthand to specify a number of other font properties in CSS ?
In this article, we are going to discuss a property that is used as shorthand to specify different font properties. The font property is a shorthand property for various font-related properties. Shortening the code in Cascade Style Sheet (CSS) helps to specify all individual related properties into a single property. The font property is used as sh
2 min read
Which specific tag is used to represent the article in HTML ?
In this article, we will see how to represent the article in HTML. The &lt;article&gt; tag is one of the new sectioning element in HTML5. The HTML &lt;article&gt; tag is used to represent an article. More specifically, the content within the &lt;article&gt; tag is independent of the other content of the site (even though it can be related). In othe
2 min read
Which specific tag is used to blink the text in HTML ?
The HTML &lt;blink&gt; tag is used to create a blinking text that flashes slowly. It has been obsolete all told fashionable browsers whereas some browsers never supported it in the least. This tag was also never standardized by hypertext mark-up language. You may recreate an identical visual impact using CSS and JavaScript. Internet usage guideline
2 min read
Which specific tag is used for describing the range of numbers in HTML Form ?
The HTML input tag is used for describing the range of numbers in HTML form. The &lt;input&gt; tag is used to define an input field where users enter data. It is used within &lt;form&gt; elements. The input format for the user can be of various types depending on the value of the type attribute of &lt;input&gt; tag. Describing the range of numbers
2 min read
How to use Radium in React app for inline styling?
Radium is a popular npm package for React which allows us to use inline styling with pseudo selectors and media queries. Without this third party package, one can not do inline styling with pseudo selectors because React doesn't allow us to use pseudo-selectors in inline styling. Examples of pseudo-selectors: hover, visited, link, etc. Steps for ad
2 min read
What is the difference between display: inline and display: inline-block in CSS?
The display property in CSS is a very useful and commonly used property that contains many values. The display property defines how an HTML element should be displayed on the webpage. The property also specifies the type of box used for an HTML element and how it should be laid out on the page. If we need to display the elements that are laid out a
4 min read
What is the difference between inline-flex and inline-block in CSS?
The display property specifies how an element should be displayed on a webpage. There can be many values, related to this property in CSS. Inline-block and inline-flex are two such properties. Although there are several values that this property can have, to understand the aforementioned, let us first look into three other values: inline, block, an
3 min read
How display: inline is different from display: inline-block in CSS ?
In this article, we will know about the display property in CSS, along with understanding the 2 different property values for display property, i.e., display: inline &amp; display: inline-block properties, &amp; will understand their basic differences &amp; implementation through the examples. The display property facilitates setting the element by
3 min read
three90RightbarBannerImg