0
CSS link to html
Hi can someone help me with this issue. My Css file is in the same directory as my html file. But my image isn't loading. I'm using sublime text. My css code is div { background: url("IMG_3672.JPG") no-repeat; background-size: cover; } Below is my html file <head> <link rel="stylesheet" href="HelloWorld.css"> </head> <body> <div></div> </body>
27 Réponses
+ 9
Try using other css properties to see if its the image that is not loading or is it that css file is not linked properly with html.
If other properties too don't work you have problem wih linking of css file.
If it does check this:
Is your image in the same directory?
Are you using the right file extension?
+ 7
Is image in same directory?
+ 7
So, there is 3 file in same folder? .html, .css, .jpg
+ 6
Try div width\height in px, in % don't work at me too.
and take out " from url. simple (.jpg)
+ 6
In my guides it written whithout ", but yes, it works and with ".
When you take size of div with picture size in px, did it work?
+ 5
Try write path to image in .html, not in css. As <img>.
+ 5
How i find px instead % for myself at now? Your div empty, try to place in it some word. With % it will appear and picture appear in size of word. When i write in px in size of picture. Picture appear fully.
+ 5
Mac... Mac.. For mac all usual css selectors works properly? Or, how for webkit, you should write -webkit-...?
+ 5
div
{ background: url("IMG_3672.JPG") no-repeat;
background-size: cover;
Padding:10%;
}
+ 4
When div has no element then the div space is not occupied when we put padding it create a invisible wall covering div so in that space it get display according to me
+ 3
You have not inserted div in html that y it not showing effects 😂😂
in css Chang div to body
it will definitely work
+ 3
Okay in css just add padding I just tried it
it's working
+ 2
Николай Шаповаленко yes save html and css in the same folder
+ 2
+ 2
<link rel="stylesheet" type="text/css" href="name_of_file.css">
Try type
+ 2
+ 1
「HAPPY TO HELP」 it still doesn't work :/
+ 1
「HAPPY TO HELP」 tried width and height 100% too but it still doesn't work
+ 1
Николай Шаповаленко why take out "
+ 1
Николай Шаповаленко both doesn't work for me. Remove " but it doesn't work. Tried in PX and it doesn't work also. I'm using mac btw