Home > Net >  Can't add a picture from my computer to css styling
Can't add a picture from my computer to css styling

Time:09-11

I can't add a file from my computer to use for my background on my website. Can only use URLs. How can I get the local file added?

Can't add local file on Line 18

CodePudding user response:

because you are setting width to 100% instead use a px or rem value.100% means 100% of its parent & i assume it doesn't have a parent.

 div {
            height: 320px;
            width: 240px;
            background: url(https://upload.wikimedia.org/wikipedia/commons/c/c9/-Insert_image_here-.svg);
            background-position: center;
            background-repeat: no-repeat;
            background-size: contain;
        }
<div></div>

  • Related