HTML style

HTML Styles


Therm stvle attribute is used to add stvles to an element. such as color. font. size and more.


Example

I am Red

I am Blue

I am Big


The HTML Style Attribute


Setting the style of an HTML element, can be done with the stvle attribute

The HTML style attribute has the following syntax:


<tagname style="property: value;">


Background Color


The CSS background-color property detines the background color for an H1ML element.


HTML supports 140 standard color names. 👈🏻Click here 


Example


Set the background color for a page to blue:

<body style="background-color:blue;">

<h1>This is a heading</h1›

<p>This is a paragraph.</p>

< /Body>


Example

Set backaround color for two different elements.

<Body>

<h2 style="background-color:blue;">This

a heading</h2>

<h1 style="background-color:tomato;">this

is a pararaph.</h1>

</Body>


Text Color

The CSS color propertv defines the text color for an HTML.


Example

<h1 style="color: blue;">This is a heading</h1>


Fonts

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


Example

<h1 style="font-family:verdana;">This is a heading</h1>


Text Size

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


Example

<h1 style="font-size:300%;">This

is a heading </h1>


Text Alignment

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


Example

<h1 style="text-align:center;">Centred heading</h1>


 Summary

• Use the style attribute for styling HTML element

• Use background-color for background color

• Use color for text colors

• Use font-family for text fonts

• Use font-size for text sizes

• Use text-align for text alignment 

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.