Background Image in HTML:

You have already know that how can you apply a color to full body of a page. Now in this topic we learn how to create a background with an image and how to write content on that image.

You can apply image as a background directly and also you can do it by applying CSS.


In following example we directly apply background property:


This image is on my PC so please use an image which is available on your PC.

Background Image with URL:

You can add a url to background and create an image as a background. We use in following example “no-repeat” property of “background:url” so that the image will not repeat on the page.

But if you want to repeat the image you have to set repeat property.


Colors in HTML:

In HTML there are numbers of colors are available. In this topic I will tell you the three most common pattern or code of selecting color.

String Color Code in HTML:

You can directly pass a string to colour names. There are 140 color names are defined in HTML5 and CSS3. Here we learn the 17 most generic color names which specified in HTML.

 Hexadecimal Color Code in HTML:

You can also define colors using hexadecimal code or value. The value of code is start with “#” and then continues with 6 characters. Character should be combination of numbers and letters or should be only number or only letter.

RGB Color Code in HTML:

RGB refers to Red, Green and Blue. In this pattern we set color in the combination of red, green and blue as a rgb(0,122,256). The numbers is written b/w brackets are the level of each color. Levels of all three color is form “0” to “256”.


In following example we give the name of color, hexadecimal value of color and rgb code of color.

Table for Colors

Color Color Name Hexadecimal Value RGB Value
RED #FF0000 rgb(255,0,0)
LIME #00FF00 rgb(0,255,0)
BLUE #0000FF rgb(0,0,255)
Yellow #FFFF00 rgb(255,0,0)
BLACK #000000 rgb(0,0,0)
WHITE #FFFFFF rgb(255,255,255)
GREY #808080 rgb(128,128,128)
MAROON #800000 rgb(128,0,0)
GREEN #008000 rgb(0,128,0)
OLIVE #808000 rgb(128,128,0)
SILVER #C0C0C0 rgb(192,192,192)
AQUA #00FFFF rgb(0,255,255)
NAVY #000080 rgb(0,0,128)
FUCHSIA #FF00FF rgb(255,0,255)
PURPLE #800080 rgb(128,0,128)
TEAL #008080 rgb(0,128,128)

3 responses to “HTML Background and Colors”

  1. Alton says:

    You share interesting things here. I am really very thankful to you for very interesting site.

  2. Melvin says:

    You share interesting things here.Finally i found something that is easy to understand. Thanx buddy………

  3. Ellie says:

    Hey, simply looking round some blogs, seems a pretty good platform you might be using.

Leave a Reply

Your email address will not be published. Required fields are marked *