Anyone can help me inserting a background image in this code - html

#slide-1 .bcg {background-image:url('fancaps.jpg')}
I have the image fancaps.jpg in the same folder as my css and index file but when I preview it nothing happens. Anyone have any advice

Change your CSS code to
#slide-1 .bcg {
background-image:url(fancaps.jpg);
}
OR
#slide-1 .bcg {
background:url(fancaps.jpg);
}
Tried both, either should work. If your images are in an "images" folder, adjust the folder with -
url(../images/imagename.jpg)

Related

background image not loading in external CSS ( relative path used)

what the CSS file looks like:
h1{
.....
}
body{
background-image: url(/img/back.png) ;
}
what the files hierarchy looks like:
img(file containing the images)
-back.png(the background image i want to keep as background)
.css
.html
i am not sure why the image is not loading even though i have used relative path to the css file as suggested by the asnwers in past questions similar to this. if anyone can help thank you.
The rest of CSS is working just a problem with this background-image issue

Background image not appearing in WordPress

My background image not appearing in WordPress though I have included this code in my style.css
body{
background: url("/wp-content/themes/my_theme/images.png");
}
Please help.
To add the theme background image in wordpress add the below code in css file .Used ../ to go to folder instead of using the full path
body{
background: url("../images.png");
}
body { background: url("./images.png");}
I tried this out with a test site local hosted on XAMPP. Single dot for relative URL in the same directory, it must be a Wordpress/localhost thing because usually just "images.png" works.
okay I find it out.
My wp-content folder was also inside a folder named wordpress.
so the correct code would be :
body {
background : url("/wordpress/wp-content/themes/my_theme/images.png");
}

CSS Background-Image Tag

So I have created a simple html file with a CSS page linked to it. I am trying to put an image entitled "texture.png" as that background. It is contained within the file "images" while the "CSS" folder contains the CSS page. Both of these folders containing the necessary files are within the same folder. Because we are within the CSS folder I thought we needed to go out of the CSS folder and tell it to go into the images folder. This is what I had:
body {
background-image: url("../images/texture.png");
background: black;
}
I was pretty sure that the .. at the beginning of the url would work, but still it would not work. Any idea of any solutions?
It will always take the last condition you apply. Here you apply the last condition as color not the image, so it was always taking color.
Try:
body {
background: black;
background-image:
url("http://yourdomain.com/images/texture.png");
}
Demo
May it helps!
body {
background-image: url("../images/texture.png");
background-color: black;
}

CSS - Can't locate the background file

I'm trying to put in a background image for my website and the background remains white. On inspect element it says that my image could not be found.
The CSS file is linked with the HTML file because other images work, and the full directory is:
F:\Pete\Web Design\Assignment\images\background.jpg
Image link for the error, if it helps:
body{
background-image:url(images\background.jpg);
}
This is the code for the background image I'm using.
Try using a Forward-Slash /
body{
background-image:url(images/background.jpg);
}
If you have your CSS in a subfolder, the following may solve the problem:
body{
background-image:url("../images/background.jpg");
}
Put your path in quote
body{
background-image:url("images/background.jpg");
}
If it is different it will not work.
F:\Pete\Web Design\Assignment\images\background.jpg
F:\Pete\Web Design\Assignment\index.html

Background Image not showing up in jumbotron

I do not know what the problem is. I made a style.css and used this as my code
.jumbotron {
background-image:url(images/bikebg.jpg);
margin-top:-20px
}
before putting the background in the images folder, it worked fine. But since I changed it, it will no longer work. The site is live here http://bikesite.web44.net/bikes.html
try this
.jumbotron {
background-image:url(../images/bikebg.jpg);
margin-top:-20px
}
your folder path was wrong
try
url(../images/bikebg.jpg);