如何在
内放置背景图像?

发布于 2024-08-27 12:00:06 字数 440 浏览 8 评论 0原文

我的代码目前如下所示:

<div style="position: fixed; width: 35.25%; height: 6.75%;
    left: 0%; top: 4.625%; right: 64.75%; bottom: 88.625%;
    color: #D1E231; text-align: center; background-color: #666666;
    background-image: url('FleurTR.png'); background-position: right top;">
<div>

显示得很好,背景颜色为灰色,但背景图像根本不会显示。我在这里缺少什么?我没有理由必须指定背景附件或背景重复,对吧? (我不想再重蹈覆辙。)

My code currently looks like this:

<div style="position: fixed; width: 35.25%; height: 6.75%;
    left: 0%; top: 4.625%; right: 64.75%; bottom: 88.625%;
    color: #D1E231; text-align: center; background-color: #666666;
    background-image: url('FleurTR.png'); background-position: right top;">
<div>

The <div> shows up just fine, with the grey background color, but the background image won't show up at all. What am I missing here? There's no reason I should have to specify background-attachment or background-repeat, right? (I don't want it to repeat.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柠栀 2024-09-03 12:00:06

该图像引用是否正确?就像,它不是在文件夹中吗:

background-image: url('/images/myimage.jpg');

Is that image referenced correctly? Like, is it not in a folder:

background-image: url('/images/myimage.jpg');
雨轻弹 2024-09-03 12:00:06

尝试使用从网络链接的图像来测试它。

Try testing it with an image linked from the web.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文