×

Html & Html5

The World's best Software Development Study Portal

HTML Style Attribute


With style attribute,we can provide style to our HTML element. The HTML style attribute has the following syntax:


Syntax: syntax


1. Background color

    You can set the background color for HTML elements:

     Let's understand this by the following example:


Output:


backo


2. Text Color

    You can set the color of text.

     Let's understand this by the following example:


Output:


texto


3. HTML Fonts

    The font-family property defines the font to be used for an HTML element.

     Let's understand this by the following example:


Output:


fonto


4. HTML Text Size

    The font-size property defines the text size for an HTML element.

     Let's understand this by the following example:


Output:


tsize


5. HTML Text Alignment

    The text-align property defines the horizontal text alignment for an HTML element.

     Let's understand this by the following example:


Output: