gpt4 book ai didi

css - 对图像使用 css

转载 作者:行者123 更新时间:2023-11-28 10:23:24 24 4
gpt4 key购买 nike

我正在尝试将图像附加到 div 标签。

<div class="arrow"></div>

.left div.arrow{background-image: url(../images/design/arrow.jpg); float:left;}

使用它的 html 页面上没有显示任何内容。我做对了吗?我的图像位于正确的文件夹中。

谢谢

最佳答案

您必须设置DIVwidthheight 属性,否则DIV 基本上是不可见的,因为它没有内容。将 width&height 设置为背景图片的尺寸。

编辑:正如其他人指出的那样。您的选择器建议您的目标 div 位于类为“left”的元素内。如果不是这种情况,您的选择器将不起作用。

关于css - 对图像使用 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4571116/

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