Why background image not displaying? Here are some basic errors.
Sometimes, the background image not displaying in our browser because we forget to write folder name, to give height, etc. There are several basic errors. Some basic errors are as following-
1.We forget to write the folder name with image name like-
body{
background: url(imagename) no-repeat center;
}
So, first of all check the folder name.
2. Sometimes, the height is not give to the div or the height is auto.So, in this case, check the height property and give height to the div.
3.The folder name and image name is not correct.
like-
Our folder name is images and we write folder name
is image.
The image format is JPG and we write image format PNG.
So, check the folder name and image format.
4.When we write the correct code and even then our background image not displaying in the browser.
Correct code:-
body{
background: url(foldername/imagename) repeat;
}
So, in this case, our image folder is placed one folder up from the HTML document. so, in this situation the code used like this-
body{
background: url(../foldername/imagename) repeat;
}
5.Sometimes, the system extension is hidden and when we write extension with image, the image does not display in our browser.
So, we have to check whether the system extension is on or off.
1.We forget to write the folder name with image name like-
body{
background: url(imagename) no-repeat center;
}
So, first of all check the folder name.
2. Sometimes, the height is not give to the div or the height is auto.So, in this case, check the height property and give height to the div.
3.The folder name and image name is not correct.
like-
Our folder name is images and we write folder name
is image.
The image format is JPG and we write image format PNG.
So, check the folder name and image format.
4.When we write the correct code and even then our background image not displaying in the browser.
Correct code:-
body{
background: url(foldername/imagename) repeat;
}
So, in this case, our image folder is placed one folder up from the HTML document. so, in this situation the code used like this-
body{
background: url(../foldername/imagename) repeat;
}
5.Sometimes, the system extension is hidden and when we write extension with image, the image does not display in our browser.
So, we have to check whether the system extension is on or off.
Comments
Post a Comment