gpt4 book ai didi

css - 无法将背景图像置于背景颜色前面

转载 作者:行者123 更新时间:2023-12-03 00:37:45 24 4
gpt4 key购买 nike

我正在尝试将图像设置为背景并向内容添加背景颜色。但我无法通过背景颜色获取背景图像。另外我想要背景图像超过 span#test 任何帮助将不胜感激。

 <div id="container">
<div id="Content">
Hello world, this is my content, Hello world, this is my content <br />
Hello world, this is my content, Hello world, this is my content <br />
Hello world, this is my content, Hello world, this is my content <br />
Hello world, this is my content, Hello world, this is my content <br />
</div>
<span id="test">
Test
</span>
</div

#container
{
position: relative;
margin-bottom: -20px;
background-image: url('https://www.google.co.uk/images/srpr/logo11w.png');
background-size: contain;
background-repeat: no-repeat;
height: 50px;
width: 100px;
z-index: 10001;
}
#Content
{
background-color:#C9CACA;

}

这是链接“http://jsfiddle.net/chetangawai/FFS4V/5/” '

最佳答案

尝试

#container
{
position: relative;
margin-bottom: -20px;
background:#C9CACA url('https://www.google.co.uk/images/srpr/logo11w.png') no-repeat;

}

here Jsfiddle example

关于css - 无法将背景图像置于背景颜色前面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22034530/

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