HTML Styles


❮ Previous Next ❯

What is an HTML Styles?

The HTML style attribute is used to define how HTML elements to be view on a web page.

<StartTag style="property:value;">Webpage Content</EndTag>

property is a CSS property. value is a CSS value.


Colour, font size, font colour, background colour, borders and many other styles can be added to an element using the HTML style attribute.

Example

<p style="background-color:green; color:red;font-family:Arial;font-size:18px;text-align:center;">Paragraph Text of webpages</p> Try It ยป
  • CSS background-color property defines the background color for an HTML element.
  • CSS color property defines the text color for an HTML element
  • CSS font-family property defines the font to be used for an HTML element
  • CSS font-size property defines the text size for an HTML element
  • CSS text-align property defines the horizontal text alignment for an HTML element