简体   繁体   English

Visual Studio - 背景图像问题

[英]Visual studio - background-image issue

I tried to do an animated div with background-image and after some attempts the "url(../pic1.jpg);"我尝试用背景图像做一个动画 div,经过一些尝试后,“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.在 VS Code 上它工作正常,并且在我将任何 URL 放入例如来自谷歌的图片之后它也可以工作。 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.根据图像相对于已编译样式表的位置,url() 位中的路径将需要更改。 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.如果这是这里的问题,那么了解相对/绝对路径可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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