The HTML style
attribute is used to change or add styles to an element of Html.
Syntax:
style="property:value;"
The CSS background-color property changes or adds the background color for an HTML element.
Example
<html> <body > <h3 style="background-color: coral;" >this is a heading with background color coral </h3> <p style="background-color: fuchsia;">This is a paragraph with background color fuchisa </p> </body> </html>
this is a heading with background color coral
This is a paragraph with background color fuchisa
Text Color
The CSS color property defines the text color for an HTML element:
<html> <body> <h3 style="color: deepskyblue;">This is a heading with text color deepskyblue </h3> <p style="color: blue;">This is a paragraph with text color blue </p> </body> </html>
This is a heading with text color deepskyblue
This is a paragraph with text color blue
Text AlignmentThe CSS text-align property defines the text alignment for an HTML element.
Example<html> <body> <p style="text-align:left;">left aligned paragraph.</p> <p style="text-align:center;">Centered paragraph.</p> <p style="text-align:right;">right aligned paragraph.</p> </body> </html>
left aligned paragraph.
Centered paragraph.
right aligned paragraph.
FontsThe CSS font-family property defines the font to be used for an HTML element.
Example
<html> <body> <p style="font-family: Tahoma;">This is a paragraph with font Tahoma.</p> <p style="font-family: Times New Roman;">This is a paragraph with fontTimes New Roman.</p> </body> </html>
This is a paragraph with font Tahoma.
This is a paragraph with font Times New Roman.
Text SizeThe CSS font-size property defines the text size of an HTML element.
Example
<html> <body> <p style="font-size:30px;">This is a paragraph.</p> <p style="font-size:20px;">This is a paragraph.</p> </body> </html>
This is a paragraph.
This is a paragraph.
0 Comments