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.
是否有某种方法可以将 CSS 背景大小指定为背景图像大小的百分比。使用纯 CSS(甚至 CSS3 )似乎是不可能的,但也许有一些使用其他 CSS 属性/html 的聪明方法(这只适用于 SVG 和移动设备)。
你能试试这个方法吗
background-size: 200px; background-size: 200px 100px; background-size: 200px 100px, 400px 200px; background-size: auto 200px; background-size: 50% 25%; background-size: contain; background-size: cover;