Full width home advertisement

How To

Science

Post Page Advertisement [Top]


The default background of an HTML webpage is white in color. You can use HTML Background to design the webpage background using two main methods:

1. Html Background with Colors

2. Html Background with Images


Html Background with Colors

The bgcolor attribute is used to manage the background of an HTML element, particularly page body and table backgrounds. i.e.

<tagname bgcolor="color_value"...>

This color_value can be given in any of the following formats
:

<!-- Format 1 - Use color name -->

<table bgcolor="lime" >

<!-- Format 2 - Use hex value -->

<table bgcolor="#f1f1f1" >

<!-- Format 3 - Use color value in RGB terms -->

<table bgcolor="rgb(0,0,120)" >


Example

Here are the examples to set background of an HTML tag:

<!DOCTYPE html>

<html>

<head>

<title>Scholars HTML Background Colors</title>

</head>

<body>

<!-- Format 1 - Using color name -->

<table bgcolor="yellow" width="100%">

<tr><td>

This background is yellow

</td></tr>

</table>



<!-- Format 2 - Using hex value -->

<table bgcolor="#6666FF" width="100%">


<tr><td>

This background is sky blue

</td></tr>

</table>



<!-- Format 3 - Using color value in RGB terms -->

<table bgcolor="rgb(255,0,255)" width="100%">


<tr><td>

This background is green

</td></tr>

</table>

</body>

</html>

This will produce the following result:

This background is yellow
This background is sky blue
This background is green



Html Background with Images

Images can be used to add beautiful background to an HTML page using this tag structure: 

<tagname background="Image URL"...>

The most advisable image formats for background are JPEG, GIF and PNG images.

Example


<!DOCTYPE html>

<html>

<head>

<title>Scholars HTML Background Images</title>

</head>

<body>

<!-- Set table background -->

<table background="/images/html.gif" width="100%" height="100">

<tr><td>

This background is filled up with HTML image.

</td></tr>

</table>

</body>

</html>


Note: The background attribute is deprecated and it is suggested to use Style Sheet for background setting.

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib