HTML CSS JAVASCRIPT PHP

HTML Style



The HTML style attribute is use to add styles to an element such as color ,font,size,and more.

Example

I am red

I am blue

I am big

The HTML Style Attributes

Setting the style on an HTML element cane be done wjth the style attribute.

The Html style attribute has the fllowing the syntax.

Example

< tagname style="property:value;">

The property is a CSS and the value is a CSS value.

You will learn more about next in this CSS tutorials.


Background Color

The CSS background-color property defines the background color for HTML element.

Example

Example

Set background color for two different elements.

This is a paragraph background color red

This is another paragraph background color green


Text Color

The CSS color property defines the text color for an HTML element.

Example

Set background color for two different elements.

This is a paragraph color red

This is another paragraph color green


Fonts

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

Example

This is a heading font family verdana

This is another paragraph font family courier


Font Size

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

Example

This is a heading font size 300%

This is another paragraph font size 150%


Text Alignment

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

Example

This is a heading center

This is another paragraph center


Chapter Summary

  1. Use the style attribute styling HTML elements.
  2. Use background-color for background color.
  3. Use color for text colors.
  4. Use the font-family for text fonts
  5. Use the font-size for text size.
  6. Use the text-align for text alignment.