gpt4 book ai didi

html -
元素中不显示背景图片 - CSS/HTML

转载 作者:太空宇宙 更新时间:2023-11-03 20:30:04 29 4
gpt4 key购买 nike

screenshot of the directory structure我创建了一个 <div>元素,我将在下面使用 css <div> 风格元素。

#girls {
background-image: url("girl.gif");
}

这是我的 HTML <div>元素(此元素包含在 index.html 页面中):

        <div id="girls">
<p>
<b>Girls chat:</b> at the lounge, we're committed to providing you, our guest, with an exceptional
experience every time you visit. Whether you're just stopping by to check in on email over an elixir,
or are here for an out-of-the-ordinary dinner, you'll find our knowledgeable service staff pay attention to every
detail. If you're not fully satisfied, have a Blueberry Bliss Elixir on us.
</p>
</div>

但是当我加载索引页时,背景图像 (girl.gif) 没有显示。谁能帮我解决这个问题?

最佳答案

试试这个:

#girls {
background-image: url("../girl.gif");
}

我猜 css 位于 stylesheet 文件夹中,这就是为什么您需要上一层才能访问 girl.gif,因此使用 ../

关于html - <div> 元素中不显示背景图片 - CSS/HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44126023/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com