gpt4 book ai didi

html - 在另一个 div 前面的 div

转载 作者:行者123 更新时间:2023-11-28 07:48:37 26 4
gpt4 key购买 nike

我需要将网站容器移动到另一个带有背景的 div 前面。它应该是这样的(忽略所有其他元素,只注意背景和容器)- http://prntscr.com/7bfurw

这是现在的样子(错误): enter image description here

我正在尝试使用“position: absolute”和“top: x”进行一些尝试,但它“效果不佳”,但是当我在浏览器中使用放大镜时,它完全分散了。

这是我的实际代码...HTML:

<div class="horni-panel">
<div class="logo">
Zhlednuto.cz
</div>

<div class="menu">
Home, about atd.
</div>

</div>

<!-- Mini pozadi -->
<div class="minipozadi">
ahoj
</div>

<!-- hlavni obsah -->
<div class="container">
ahooj
</div>

和CSS:

@font-face
{
font-family: Lato-Bold;
src: url(fonts/Lato-Bold.ttf);
}

body
{
background-color: #34495e;
}

.horni-panel
{
border-top: 8px solid #34495e;
position:absolute;
top:0;
left:0;
right:0;
height: 77px;
width: 100%;
background-color: #ffffff;
}

.logo
{
color: #34495e;
font-family: Lato-Bold;
font-size: 33px;
}

.minipozadi
{
height: 282px;
width: 100%;
background-image: url(img/bg.jpg);
background-size: 100%;
background-repeat: no-repeat;
margin: 0 auto;
position:absolute;
top: 85px;
left:0;
right:0;
}

.container
{

z-index: -1;
margin: 0 auto;
top:0;
right:0;
left:0;
width: 70%;
height: 500px;
background-color: #ffffff;
border-radius: 5px;
}

最佳答案

我怀疑你在找这个

http://output.jsbin.com/puladizire/2/

.minipozadi
{
height: 282px;
width: 100%;
background:url(http://www.hdwallpapers.in/walls/abstract_color_background_picture_8016-wide.jpg);
background-size: 100%;
background-repeat: no-repeat;
margin: 0 auto;
position:absolute;
top: 85px;
left:0;
right:0;
z-index:1;
text-align:center;
font-size:30px;
}

.container
{

z-index: 100;
margin: 0 auto;
position:absolute;
top:0;
right:0;
left:0;
margin-top:200px;
width: 70%;
height: 400px;
background-color: #ffffff;
border-radius: 5px;
}

我已经在容器中添加了 marginz-index

关于html - 在另一个 div 前面的 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30556805/

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