HTML style attribute is used to style an HTML element.
The HTML style attribute specifies an inline style for an element.
Using style attribute you can change the text-color, background-color and font -size, etc of an HTML element.
Syntax:
<tagname style="property:value;">
The property is a CSS property that you want to add to the element and the value is a CSS value for the CSS property.
Text Size:
The CSS font-size property lets you set the font- size in your HTML document.
Example:
<h2 Style="font-size: 40px;"> HTML </h2>
<p style="font-size: 20px;"> HTML is basically markup language using which you can create your own website. HTML stands for Hypertext Markup Language. It contains elements and the elements are represented by tags. </p>
If you want to set the text color for an HTML element then you can use CSS color property.
Example:
<h2 Style="color: #ff5722;"> HTML </h2>
<p style="color: #1c6ced;"> HTML is basically markup language using which you can create your own website. HTML stands for Hypertext Markup Language. It contains elements and the elements are represented by tags. </p>
The font-family property of CSS is used to set different fonts for an HTML element.
Example:
<h2 style="font-family:algerian;"> HTML </h2>
<p style="font-family:Courier;"> HTML is basically markup language using which you can create your own website. HTML stands for Hypertext Markup Language. It contains elements and the elements are represented by tags. </p>
The background-color property of CSS allows you to set the background color to the HTML element.
Example:
<h2 Style="background-color: #ff5722;"> HTML </h2>
<p style="background-color: #00BFFF;"> HTML is basically markup language using which you can create your own website. HTML stands for Hypertext Markup Language. It contains elements and the elements are represented by tags. </p>
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok