The background-color property in CSS is used to set the background color of an HTML element.
Example
1.Changing the background color of a page to powder blue:
<body style=”background-color:powderblue;”> |
2.Applying different background colors to various elements:
<body> <h1 style=”background-color:powderblue;”>This is a heading</h1> <p style=”background-color:tomato;”>This is a paragraph.</p> </body> |
Utilize the CSS color property to set the text color of an HTML element.
Example
<h1 style=”color:blue;”>This is a heading</h1> <p style=”color:red;”>This is a paragraph.</p> |
The font-family property in CSS determines the font used by an HTML element.
Example
<h1 style=”font-family:verdana;”>This is a heading</h1> <p style=”font-family:courier;”>This is a paragraph.</p> |
Adjust the text size of an HTML element with the CSS font-size property.
Example
<h1 style=”font-size:300%;”>This is a heading</h1> <p style=”font-size:160%;”>This is a paragraph.</p> |
The text-align property in CSS is used for aligning text horizontally within an HTML element.
Example
<h1 style=”text-align:center;”>Centered Heading</h1> <p style=”text-align:center;”>Centered paragraph.</p> |
style
attribute.background-color
.color
property.font-family
.font-size
.text-align
.