Choose Background Color In HTML

In this article I tell you how to choose background color in HTML.
  • 4376

Introduction

In this article I tell you how to choose background color in HTML. The HTML code allows you to choose a background color of your web page. You can change the color of your web page according to requirement.

Write following code snippet into your html source where you want the form to appear on web page:

<!DOCTYPE html>

<html>

<head>

<title>Choose Background</title>

</head>

<body>

<h1>Choose Background</h1>

<form name="UserDefinedColor">

<p><font size="2" face="Calibri,Segoe UI,Times New Roman,Sans Serif"><br> <br> <input type="button" name="colr"

value=" BLUE " onclick="document.bgColor='#0066FF'"> <input

type="button" name="colr" value=" GREEN " onclick="document.bgColor='#ooFF66'">

<input type="button" name="colr" value=" PURPLE "

onclick="document.bgColor='#330099'"> <input type="button"

name="colr" value=" WHITE " onclick="document.bgColor='#FFFFFF'">

<input type="button" name="colr" value=" PINK "

onclick="document.bgColor='#FF0066'"></font> </p> </form>

</body>

</html>

Output:

 ChooseBackground.jpg

Now Click on BLUE Button. You will color of web page is changed to Blue.

ChooseBackground01.jpg

Now click GREEN Button. You will color of web page is changed to Green.

ChooseBackground02.jpg    

© 2019 DotNetHeaven. All rights reserved.