gpt4 book ai didi

html - 如何使重复 div#header2 整个长度 div#header1

转载 作者:行者123 更新时间:2023-11-28 03:27:01 25 4
gpt4 key购买 nike

代码:

#header1{width:100%;}

#header2{
position: absolute;
top: 0px;
left: 0px;
width: 75px;
height: 72px;
background: url("./image.png");
background-repeat: repeat-x;
background-position: -10px -180px;
}

<div id="header1">

<div id="header2">
</div>

</div>

请告诉我如何使 div#header2 重复整个长度 div#header1 ?

P.S.:image.png - 它包含图标。 (是一个 Sprite 图像),例如。图像打包:

enter image description here

最佳答案

Fiddle Example !
在 header2 中设置 width:100%

#header1{width:100%;}

#header2{
width:100%;
position: absolute;
top: 0px;
left: 0px;
height: 72px;
background: url("./image.png");
background-repeat: repeat-x;
}

<div id="header1">

<div id="header2">
</div>

</div>

关于html - 如何使重复 div#header2 整个长度 div#header1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20582469/

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