Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我执行以下代码时,它会一直工作到我调整页面大小时,背景图像会重复,即使背景重复设置为无。任何原因,您都可以在此处查看该页面
#mainPage{ background-image: url(../images/home.JPG); width: 100%; height: 500px; background-size: 100%; background-repeat: none; }
它是no-repeat,不是none:
no-repeat
none
#mainPage{ background-image: url(../images/home.JPG); width: 100%; height: 500px; background-size: 100%; background-repeat: no-repeat; }
无论你设置background-size不应该有所作为。
background-size