HTML Style attribute is used to give style (like text color, text fonts, background color etc.) to the content of web page.
HTML Style attributes are defined by style="property:value;" syntax.
In the place of property, we can give properties like color, font-size, width, height etc.
In the place of value, we can give values of properties like color(red, greeen, blue), font-size(10px, 20px) etc.
It can be used with any HTML element inside Opening tag.
In the above, we have shown an example of HTML Style Attribute.
In Paragraph Tag, we have used color style attribute which is used to give color to the text. For more HTML Text Color
Run the code to see the effect.
In the above, we have shown an example of HTML Style Attribute.
In Bold Tag, we have used font-family style attribute which is used to give different fonts to the text. For more HTML Fonts
Run the code to see the effect.
In the above, we have shown an example of HTML Style Attribute.
In Heading Tag, we have used text-align style attribute which is used to align the text on the web page. For more HTML Text Alignment
Run the code to see the effect.
In the above, we have shown an example of HTML Style Attribute.
In Paragraph Tag, we have used font-size style attribute which is used to change the font size of the text. For more HTML Text Size
Run the code to see the effect.
Two or more style attribute can be used in same HTML element and each style should be separated with (;) semi-colon.