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);
Related
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");
}
So I am really new at programming (literally started yesterday lmao). So I wrote the code and everything and the backround color just doesn't want to change to black. I also have an issue where my image is not showing up on my webiste (it used to but now its only an blank square).
Thanks for answers :)
Please check your CSS file, in CSS file yoou write background:red; so please change that with below code.
<style>
body
{
background-color:red;
}
</style>
For background, you need to write complete term background-color: red; to make it work.
For image, make sure that the image exists in the same directory as the HTML file as you are not giving any extra path in your code.
Also, I would suggest that you go through any beginner guide on youtube first so that most of your queries are answered.
For colouring background, you need to change this:
body { background-color: red; }
And for your image issue, make sure you are entering the right path of the image.
You can also refer here: https://www.w3schools.com/tags/tag_img.asp
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
#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)
I have a really weird problem. I have tried to use CSS to set the backgorund of the body, but it doesn't allow me. When I'm using the simple HTML tags within the tag
<body background="images/bg.jpg">
its WORKING! BUT when I'm using this in CSS:
body {
background-image: url(../images/bg.jpg);
}
It doesn't shows the BG image.
Everything is correct, if I check the folders, everything is in its place. I have tried this in Chrome and Mozilla, but neither of them are working.
Any suggestions?
If your CSS is inline:
<style>
body { background-image: url('images/bg.jpg'); }
</style>
If you're using a file, say css/main.css:
body { background-image: url('../images/bg.jpg'); }
Alternatively, you could use an absolute path:
body { background-image: url('/images/bg.jpg'); }
This example requires the image directory to be in the root web directory.
Try url("./images/bg.jpg") or url("/images/bg.jpg").
I had exactly the same trouble here. I thought that I tried everything but ... There was one more thing.
Firstly, my css path as followed:
assets/css/custom/main.css
my image folder as followed:
assets/img/bodyBackround.jpg
In order to display my backround on the page using css I had to go 2 folders back. Example from my page:
body{
background: url(../../img/bodyBackround.jpg) repeat;
}
Where ../../ means go back 2 folders. Hope this helps.
More information can be found here http://jeffreybarke.net/2013/06/paths-and-urls-relative-and-absolute/