两个div重叠,如何修复?

时间:2017-04-13 07:22:56

标签: html css ipad mobile overlap

显然,我在同一行重叠上有两个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>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

<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
}

}