How to Add a Background to a Website
A solid colored background is the most basic type of background that you can put on a website., Open your web code (source). , In the body tag, add an attribute called bgcolor., Experimenting with RGB and # can lead to many shades, but you can take...
Step-by-Step Guide
-
Step 1: A solid colored background is the most basic type of background that you can put on a website.
In fact, every website begins with a default white background.
However, while a white background can be very sleek and clean looking when used with a harmonious color scheme, a different colored background may be favored with different themes. -
Step 2: Open your web code (source).
, Now, you body tag should look like this-<body bgcolor="COLORNAME"> where COLORNAME is the name of the color.
COLORNAME can be filled with many types of color representatives- <body bgcolor="red">(color name) <body bgcolor="#FF0000">(hex value) <body bgcolor="rgb(255, 8, 9)">(RGB value) , But remember that typing an uncommon color as "Ultramarine Bluish Green" will result in white. , <body background="red.gif">(in same folder) <body background="\Folder1\red.gif">(inside a different folder) <body background="imagepage1/red.gif">(in a different webpage) ,, You can also give IDs and Classes and use both External and internal stylesheets. ,, You can also give IDs and Classes and use both External and internal stylesheets. ,, It can be from the same folder, different folder or a different web page. <body style="background-image:red.gif;">(in same folder) <body style="background-image:\Folder1\red.gif">(inside a different folder) <body style="background-image:imagepage1/red.gif">(in a different web page). ,, Your body tag must be now changed to-<body style="background-image: url('SRC'); background-repeat:
REPEAT-SETTINGS; "> Where REPEAT-SETTINGS are the settings.
There can be many repeat settings, like- <body style="background-image: red.gif; background-repeat: repeat;">(The background will repeat both vertically and horizontally.) <body style="background-image: red.gif; background-repeat: repeat-x;">(The background will repeat horizontally.) <body style="background-image: red.gif; background-repeat: repeat-y;">(The background will repeat vertically.) , To do them you just need to do some simple tweaks to the code in the above section.
Do the tweaks to make the body tag look like this- <body style="background-image:url('SRC'); background-attachment:fixed; background-position:
POSITION; background-repeat:
REPEAT SETTINGS;"> where SRC is the source of the background image, POSITION is the position of the image(it can range from center to top-right); background-attachment is the main "catalyst" of this background type.
It is used to tell the position of the background and it is recommended that it should not be changed. -
Step 3: In the body tag
-
Step 4: add an attribute called bgcolor.
-
Step 5: Experimenting with RGB and # can lead to many shades
-
Step 6: but you can take the easy first way.
-
Step 7: Add the background property to the body tag
-
Step 8: so it looks like this-<body background="SRC"> where SRC is the source of the image SRC can be in the same folder
-
Step 9: or another folder/webpage.
-
Step 10: Remember to type the .gif/ .jpeg /.bmp extension.
-
Step 11: To add a solid colored background in CSS
-
Step 12: add a style attribute.
-
Step 13: Your body tag should look like this- <body style="background-color: COLORNAME;"> where the COLORNAME is the name of the color
-
Step 14: hex value or RGB(Also remember the last steps of the solid colored background in HTML
-
Step 15: the are applicable here too) .
-
Step 16: To add an image
-
Step 17: add the style attribute to the body tag.
-
Step 18: Your body tag should now look like this- <body style="background-image:url('SRC'); ">
-
Step 19: Remember that SRC is the source.
-
Step 20: Remember to add the .extensions too.
-
Step 21: To make a repeated pattern background
-
Step 22: add a background as said in the steps above.
-
Step 23: Fixed image backgrounds look cool and do not change as you scroll down.
Detailed Guide
In fact, every website begins with a default white background.
However, while a white background can be very sleek and clean looking when used with a harmonious color scheme, a different colored background may be favored with different themes.
, Now, you body tag should look like this-<body bgcolor="COLORNAME"> where COLORNAME is the name of the color.
COLORNAME can be filled with many types of color representatives- <body bgcolor="red">(color name) <body bgcolor="#FF0000">(hex value) <body bgcolor="rgb(255, 8, 9)">(RGB value) , But remember that typing an uncommon color as "Ultramarine Bluish Green" will result in white. , <body background="red.gif">(in same folder) <body background="\Folder1\red.gif">(inside a different folder) <body background="imagepage1/red.gif">(in a different webpage) ,, You can also give IDs and Classes and use both External and internal stylesheets. ,, You can also give IDs and Classes and use both External and internal stylesheets. ,, It can be from the same folder, different folder or a different web page. <body style="background-image:red.gif;">(in same folder) <body style="background-image:\Folder1\red.gif">(inside a different folder) <body style="background-image:imagepage1/red.gif">(in a different web page). ,, Your body tag must be now changed to-<body style="background-image: url('SRC'); background-repeat:
REPEAT-SETTINGS; "> Where REPEAT-SETTINGS are the settings.
There can be many repeat settings, like- <body style="background-image: red.gif; background-repeat: repeat;">(The background will repeat both vertically and horizontally.) <body style="background-image: red.gif; background-repeat: repeat-x;">(The background will repeat horizontally.) <body style="background-image: red.gif; background-repeat: repeat-y;">(The background will repeat vertically.) , To do them you just need to do some simple tweaks to the code in the above section.
Do the tweaks to make the body tag look like this- <body style="background-image:url('SRC'); background-attachment:fixed; background-position:
POSITION; background-repeat:
REPEAT SETTINGS;"> where SRC is the source of the background image, POSITION is the position of the image(it can range from center to top-right); background-attachment is the main "catalyst" of this background type.
It is used to tell the position of the background and it is recommended that it should not be changed.
About the Author
Doris Martinez
Professional writer focused on creating easy-to-follow crafts tutorials.
Rate This Guide
How helpful was this guide? Click to rate: