I want to add background image in my css code but it\'s not loading. How to change or add background image in css please help I\'m written css code in notpad++
.Your class name {
background-image: url("your image url");
background-repeat: no-repeat;
background-size: 100% 100%;
float: left;
width: auto;
}
Please try Above type of code in your css section.
you can add that as this.
if you have id
#yourid{
background-image: url("your image url(EX:imge.jpg)");
}
if you have class
.yourclass_name{
background-image: url("your image url(EX:imge.jpg)");
}
you can use background function also...if you add background css function,you should have to change width and height
.yourclass_name {
background: url("img_tree.png") no-repeat;
height:500px or give to precentage(30% like that);
width:1000px or give to precentage (70%);
}
This is the path u should specify, The way to copy the path is to go the directory where the image is present, then copy path there.
body { background-image:url("C:\1.jpg");
If you want to add an image as background-image in CSS, there are two ways of doing it:-
background-image: url("your image url");
example:
background-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQms3mJIPu3jlPy8b8cOmRg69qurCA82EBDofx6jaK11cUM6u4w");
background-image: url("your image path");
example:
background-image: url("C:\Users\Vimalendu Shekhar\Downloads\image.jpg");