The backgrounds (backgrounds) HTML can be defined by color values or designed with an image file. By choosing the right background, you not only improve the design of your website, but you also guarantee the legibility of its content.
Backgrounds HTML: What is it exactly?
There surface behind the contents A website is the background HTML, that is to say the background. These backgrounds can be chosen by the user when creating the HTML page and being modified later. By default, the HTML backgrounds are entirely white. However, it is recommended to modify them, not only to improve the design of the website, but also to ensure better visibility of the content.
Web accommodation
Flexible, efficient and safe web accommodation
- SSL certificate and DDOS protection
- Data backup and restoration
- Assistance 24/7 and personal advisor
What can we use as a background HTML?
There are two different methods to create HTML backgrounds:
- via a color value
- from an image or a gradient of colors
The values are defined via the HTML attribute style. You will discover in the following paragraphs the procedure for these two possibilities.
Advice
In our separate article, you will learn more about the possibilities offered by HTML style.
Define a color for HTML backgrounds
To modify the color of the HTML backgrounds, use the attribute style and HTML property background-color Or bgcolor. To indicate the color valueyou have three different options:
- Color name : You have the possibility of calling the color desired by its name in English. In addition to standard values as
red,,yellowOrgreenspecial colors likelightblueOrdeepskyblueare also possible. Capper and lower case do not matter. - Hexadecimal color code : You can define the colors using their six -digit hexadecimal code. This consists of three pairs of figures
0has9and lettersahasf. The first two characters represent the value of the red, the following two that of the green, and the last two that of blue; the combination00being the lowest value andffThe highest. Blue would therefore be0000ff. - RGB value : Finally, you can use the RGB value, which is also the basis of the hexadecimal color code. The values are in the spectrum
0has255And refer to red, green and blue colors again. The value of the blue would therefore be RGB (0, 0, 255).
The syntax allowing you to choose the color of your HTML backgrounds is following:
In the following example, we use a hexadecimal color code to define a light blue as a background color:
Exemple d’arrière-plan
Voici le contenu de votre site Web.
html
The result looks like this:


If necessary, you can also define colors for HTML backgrounds separately for the different areas of your websites. For this, we also use the attribute style and HTML property background-color. You can see the operation in the following example, in which different colors have been chosen for the general background as well as for the backgrounds of the titles
:
Exemple d’arrière-plan
L’arrière-plan de ce titre a la valeur de couleur DodgerBlue.
Cet arrière-plan a la valeur de couleur DarkTurquoise.
html


Define images as backgrounds html
To be able to use graphics or images in HTML backgrounds, they must be in the image formats Jpg,, Png,, Svg,, Webp Or Gif. In the following example, here is the code necessary for the integration of an image in the background. Obviously, the path to the image must be adapted individually.
Exemple d’arrière-plan
Voici le contenu de votre site Web.
html
When using an image, it is important to keep the readability of the content in mind. By indicating other parameters, you can adapt the positioning Image or graphic for this purpose.
Domain name
Your domain in one click
- Domain .eu or .fr + free site publisher for 6 months
- 1 SSL WildCard certificate per contract
- 2 GB email box

