在我的站点中,我必须在特定表格中插入图像作为背景。我这样做了,但图像看起来像双图像,因为图像小于单元格宽度和高度,它正在重叠。
在背景图像单元格中,我使用 no-repeat 来结束相同图像的重复显示,但它不起作用。我在 django 框架中使用 html 设计网页。
模板是
<td background="{{ STATIC_URL }}images/sample.JPG" no-repeat;>
请问如何取消同一个背景图片在表格单元格中的重复显示。
谢谢
最佳答案
看看我是怎么做到的: 在模板中,我放置了以下行:
<body id="bg" style="background-image: url('{% static "images/33.jpg"%}')";>
在 CSS 中:
#bg{
background-size: 1800px 900px;
background-repeat: no-repeat;
background-position: top;
background-attachment: fixed;
}
结果我获得了固定的背景和屏幕的比例。
关于html - 如何在django中为模板应用背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16014910/