gpt4 book ai didi

html - CSS - 在背景图像上填充

转载 作者:太空宇宙 更新时间:2023-11-04 15:47:09 25 4
gpt4 key购买 nike

当我使用 .gif 或 jpg 图像时,以下代码通常对我来说效果很好。

#contentBox1{ position:relative; width:980px; background:url(../images/bg-middle.png) repeat-y; min-height:80px;   }
#contentBox2{ position:relative; width:980px; background:url(../images/bg-top.png) no-repeat top; }
#contentBox3{ position:relative; width:980px; background:url(../images/bg-bottom.png) no-repeat bottom; min-height:500px; }

<div id="contentBox1"> <div id="contentBox2"> <div id="contentBox3"> Content Text Goes Here. </div> </div> </div>

但如您所见,我使用 .png 是因为所有内容都需要透明度才能看穿背景。所以“middle.png”背景出现在页眉和页脚后面。我需要在这个 div 的顶部和底部留出所有空间,但似乎无法找出最佳的 CSS 代码来完成这项工作。

Example

最佳答案

你可以试试这个:

  1. top + middle images 合并为一个图像,并使中间部分非常长。
  2. 将其作为 div 的背景图片
  3. 在上面的 div 中放置第二个 div,底部图像作为背景图像与该 div 的底部对齐。使底部图像不透明,但用黄色 bg 颜色 将其填充在云周围。

关于html - CSS - 在背景图像上填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11610012/

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