2017-04-13 79 views
0

顯然,我在同一行重疊上有兩個div,它在PC上顯示正常,但不在Ipad或移動設備上,任何人都可以查看代碼並告訴我我錯過了什麼?兩個div重疊,如何解決?

這是與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>

+0

您可以發佈[的jsfiddle(https://jsfiddle.net /)與你的代碼? – user3004449

+1

爲什麼絕對位置視頻? – Lucian

+0

想知道是否需要將視頻放在右上角> – Swapna

回答

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

} 
+0

這是鏈接https://jsfiddle.net/vrdq92ox/ –

+0

或者使用'bootstrap'很容易修復這個錯誤 –

+0

你建議使用整個框架來解決一個簡單的問題?這是最糟糕的措施。 – Lucian