Home > Net >  using div for css image- image not displaying on html
using div for css image- image not displaying on html

Time:07-10

Can anyone tell me why this image will not display? I'm using BBedit and the image is in the same folder as the index and style.

HTML:

<div ></div>

CSS:

imghome{
    display: block;
    height: 300;
    width: auto;
    background-image: url("/pineapplenoir.jpg");
}

CodePudding user response:

If all the files are just sitting in a single directory and you are not on a server then the path to the file probably doesn't need the slash.

imghome{
    display: block;
    height: 300;
    width: auto;
    background-image: url("pineapplenoir.jpg");
}

CodePudding user response:

.imghome{
    display: block;
    height: 300;
    width: auto;
    background-image: url("pineapplenoir.jpg");
}

in css file while attempting to use styling for classes you have to use . infront of the classname in css file in order to styling to apply

  • Related