简体   繁体   中英

Visual studio - background-image issue

I tried to do an animated div with background-image and after some attempts the "url(../pic1.jpg);" part is not giving the picture witch is added to project. On VS Code it works fine, and after I put any URL to picture for example from google it also works. What is wrong?

Code Here:

<style>
    .huge-ball {
        position: absolute;
        height: 300px;
        width: 300px;
        border-radius: 100%;
        z-index: 5;
    }

    .left-bottom {
        left: -60px;
        bottom: -60px;
        background-image: url('../pic1.jpg');
    }

    .right-bottom {
        right: -60px;
        bottom: -60px;
    }

</style>

<div>
    <div>
        <div class="left-bottom huge-ball">

        </div>
        <div class="right-bottom huge-ball">

        </div>
    </div>
</div>
background-image: url('../pic1.jpg');

Depending on where the image is relative to the compiled stylesheet, the path in the url() bit will need to change. If the image is in the same folder as the stylesheet, then the style would just be the below.

background-image: url('pic1.jpg');

It may be helpful to understand relative/absolute paths if that is the issue here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM