0
Don't know why the background image code is not working😠
creating a website for a college assignment and the code I'm putting in for a background isn't working and I don't know why. Just to let people know I'm new at code.i know that the css and html are linked because I did stuff with it in college but accidentally deleted the most up-to-date file so at the moment I'm trying to remake everything also don't know if this will help but I'm making the website on atom. code used: body { background-image: url("images/homeimage.jpg");
13 Answers
+ 2
Its hard to troubleshoot your problem as there are many factors to take into consideration when your styles are not working. Is your css linked to your html? Is there another css rule that could be be taking precendance over the other css rules? You can also use developer tools in your browser to find bugs in your code. You can also use a css validator to see if you may have misspelt a word or letter. Its very hard to tell if you only have one css rule to go by to fix your code. Do you have a link to your project that we can see? I can see you have an images folder where the img is linked to. Is the image in that folder? Or it may have been shifted somewhere else?
try reading mdn might help https://developer.mozilla.org/en-US/docs/Web/CSS/background-image
0
Oh okay... hey were all beginners here. 😅One of the most useful tools to have in your skill set is to know how to debug your code when it doesnt work. You can use the code playground in sololearn its really fun to use. Ok good luck
0
#Cameron McAuley, did you find the info you needed?
0
sadly no. I'm going in to college to try and find out if somehow the code I'm putting in isn't right or if there's another code conflicting with it.🙁
0
can you post the code up here. between Dwain and myself I'm sure we can point out any issues there may be.
0
this is the code I put in the css coding area to try and use a photo I took as a background.
code used: body {
background-image: url("images/homeimage.jpg");
}
0
If you're using embedded styling try this
<head>
<meta charset="utf-8" />
<title></>title>
<style type="text/css">
<!--
styling goes here
-->
</style>
</head>
0
if you're using external then it's
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="cssfile.css" />
</head>
0
just make sure there are no spelling errors, missing characters, and that everything is spaced like it should be. I'll look in my old textbook and make sure the styling you're trying to use is correct (it looks correct, I just want to double check)
0
Ok thanks I'll try these when I go in tomorrow
0
Alright. Let's us know what it is when you get it figured out.
0
turns out I had moved and created new folders so some key text was missing from the code that linked my html and css page.sooo angry about how small the problem was.😠😠😠
0
lol it happens. glad you figured it out.