gpt4 book ai didi

css - 如何在带有 url 背景的速记属性中使用 "background-size : contain"。?

转载 作者:行者123 更新时间:2023-12-05 01:20:31 24 4
gpt4 key购买 nike

下面的 css 与 contain 一起工作,因为它单独作为 background-size 给出,但不是通过使用在 background 中给出的简写

连我也很想知道CSS中background的参数顺序属性

body { 
background: #00ff00 url("smiley.gif") no-repeat fixed center;
background-size:contain,contain;
}

body {
background: #00ff00 url("smiley.gif") no-repeat contain,contain fixed center;
}

but this is not working as i tried this shorthand method as above
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>

单独使用没有问题,但需要知道是否有任何方法可以使用 background-size:contain 简写 background 属性

即使您可以通过更改 W3School 的示例来检查它,这里是它的 url

click to check your way

最佳答案

background: #00ff00 url("smiley.gif") no-repeat fixed center / contain; 

这应该有效。

关于css - 如何在带有 url 背景的速记属性中使用 "background-size : contain"。?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32308532/

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