banner



How To Put Background Color In Html

How to Alter Background Color in Html

In HTML, we can modify the colour of the groundwork of a webpage using the following different ways:

  1. Using bgcolor aspect
  2. Using an Inline style aspect
  3. Using internal CSS

1. Using bgcolor aspect

Note: HTML v does not support the bgcolor attribute of <body> tag, so we have to use the inline style attribute and internal CSS options for irresolute the colour of a web page.

If we want to modify the color of a background of a web page using bgcolor attribute, nosotros have to follow the steps which are given below. Using these steps, we tin easily change the color of a background:

Step 1: Firstly, nosotros have to type the Html lawmaking in whatever text editor or open the existing Html file in the text editor in which we want to use the bgcolor attribute for irresolute the groundwork colour of that Html folio.

Step 2: Now, motility the cursor within the starting <body> tag in our Html document. And, and then blazon the bgcolor aspect every bit shown in the following block:

Step iii: Now, nosotros take to requite the colour which we want to utilize on the groundwork of the webpage. So, blazon the name of color in the bgcolor attribute as described in the following cake.

Test it Now

Footstep 4: And, at final, we have to relieve the Html code in the text editor and run the code. Afterwards execution, we will see the groundwork of the spider web folio in the same colour which is specified in the document. The following screenshot shows the output of the above Html code:

How to Change Background Color in Html

ii. Using an Inline Way aspect

If we want to change the color of a background of a web folio using an inline style aspect, we take to follow the steps which are given below. Using these steps, we can hands change the colour of background.

Step one: Firstly, nosotros take to blazon the Html code in any text editor or open up the existing Html file in the text editor in which nosotros desire to utilize the Inline manner attribute for changing the groundwork color of that Html page.

Step 2: Now, movement the cursor inside the starting <torso> tag in our Html document. And, then type the way attribute as shown in the following block:

Pace three: Now, nosotros take to give the color which we want to use on the background of the webpage. And so, blazon the proper noun of colour in the background-colour property of style attribute as described in the following block.

Test information technology At present

Step 4: And, at terminal, nosotros have to salvage the Html code in the text editor and run the code. After execution, we will see the background of the web page in the same color which is specified in the document. The following screenshot provides the output of the above Html code:

How to Change Background Color in Html

3. Using an Internal CSS

If we want to change the color of a background of a web page using an internal cascading stylesheet, nosotros have to follow the steps which are given below. Using these steps, we can easily modify the groundwork color.

Stride i: Firstly, we have to blazon the Html code in any text editor or open the existing Html file in the text editor in which we desire to use the internal CSS for irresolute the background color of that Html page.

Pace 2: At present, we accept to place the cursor in the head tag of the Html document and then define the styles within the <style> tag as shown in the post-obit cake. And, then type the background-color attribute into the body chemical element.

Test it At present

Step 4: And, at last, we have to salve the Html code in the text editor and run the lawmaking. After execution, we volition meet the groundwork of the spider web page in the same color which is specified in the document. The following screenshot shows the output of the above Html code:

How to Change Background Color in Html

How To Put Background Color In Html,

Source: https://www.javatpoint.com/how-to-change-background-color-in-html

Posted by: dupreexer1976.blogspot.com

0 Response to "How To Put Background Color In Html"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel