HTML Style

HTML Style

HTML style attributes used to design or style code like color, font size, etc…

Background Color

you can change the background color of the page of containers using this code background-color

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

<h1>This is my heading</h1>
<p>This is my paragraph.</p>


Change the Background color of Elements


<h1 style="background-color:powderblue;">This is a heading</h1>
<p style="background-color:tomato;">This is a paragraph.</p>


Text Color

Also, you can change the text color

<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>


you can change fonts using this code

<h1 style="font-family:verdana;">This is my heading</h1>
<p style="font-family:courier;">This is my paragraph.</p>

Text Size

Change text size using font-size

<h1 style="font-size:300%;">This is my heading</h1>
<p style="font-size:160%;">This is my paragraph.</p>

Text Alignment

you can define the text alignment like horizontal or vertical

<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>

Leave a Reply