gpt4 book ai didi

html - 两个div重叠,如何解决?

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

显然,我在同一条线上有两个 div 重叠,它在 PC 上显示正常但在 Ipad 或移动设备上显示不正常,任何人都可以查看代码并告诉我我错过了什么?

这是与 youtube 视频重叠的内容。

代码:

.timeline {
padding: 0px 30px;
width: 100%;
}

.timeline:before {
content: "";
position: absolute;
top: 20px;
left: 45px;
width: 3px;
height: calc(100% - 0px);
background: #13294b;
}

.timeline .column {
margin: 20px 20px 20px 80px;
}

.h1 {
font-size: 55px;
color: #6a6a6a;
font-family: serif;
padding: 60px 0px 60px 0px;
font-weight: bold;
}

.icon {
content: "";
position: absolute;
left: -120px;
top: 40px;
background: #fff;
}

.timeline .column .title h2 {
margin-top: -70px;
margin-left: 115px;
font-size: 20px;
}

.timeline .column .description p {
font-size: 14px;
line-height: 20px;
margin-left: 20px;
margin-top: 10px;
}

.timeline .column .description {
border-left: 2px solid #59cbe8;
border-bottom: 2px solid #59cbe8;
}

.video {
position: absolute;
right: 0px;
top: -90px;
    <div class="timeline">
<div class="column">
<div class="title"><div class="icon"><img src="source"></div>
<div class="h1">2017</div>
<h2> title </h2></div>
<div class="description">
<div class="video">
<iframe width="280" height="158" src="youtube video link" frameborder="0" allowfullscreen></iframe>
</div>

<p>content</p>
</div>
</div>
</div>

最佳答案

<div class="timeline">
<div class="column">
<div class="title"><div class="icon"><img src="source"></div>
<div class="h1">2017</div>
<h2> title </h2></div>
<div class="description">
<div class="video">
<iframe class="iframe" width="280" height="158" src="youtube video link" frameborder="0" allowfullscreen></iframe>
</div>

<p>content</p>
</div>
</div>
</div>

最好使用一些媒体查询

.timeline {
padding: 0px 30px;
width: 100%;
}

.timeline:before {
content: "";
position: absolute;
top: 20px;
left: 45px;
width: 3px;
height: calc(100% - 0px);
background: #13294b;
}

.timeline .column {
margin: 20px 20px 20px 80px;
}

.h1 {
font-size: 55px;
color: #6a6a6a;
font-family: serif;
padding: 60px 0px 60px 0px;
font-weight: bold;
}

.icon {
content: "";
position: absolute;
left: -120px;
top: 40px;
background: #fff;
}

.timeline .column .title h2 {
margin-top: -70px;
margin-left: 115px;
font-size: 20px;
}

.timeline .column .description p {
font-size: 14px;
line-height: 20px;
margin-left: 20px;
margin-top: 10px;
}

.timeline .column .description {
border-left: 2px solid #59cbe8;
border-bottom: 2px solid #59cbe8;
}

.video {
position: absolute;
right: 0px;
top: -90px;

@media only screen and (max-width: 500px) {
.iframe
{
//your css
}

}

关于html - 两个div重叠,如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43385976/

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