2016-06-28 86 views
2

對於我的項目,我需要製作一個響應式表格,其中包含HTML5視頻。Responsive HTML/CSS

例子: http://ads.memo2.nl/Jeroen/2016/TVTest.html

<html> 
 
    <body> 
 
    <head> 
 
     <title> :: MeMo2 :: </title> 
 
     <style type="text/css"> 
 
     table { 
 
      font-size: 0; 
 
     } 
 
     </style> 
 
     <script src="http://ads.memo2.nl/Jeroen/2016/JWPlayer/jwplayer-7.4.4/jwplayer.js"></script> 
 
     <script>jwplayer.key="7lMg3sdALZwtB8ygJTZ/MDB0lyJ+bFuyT7qDEQ==";</script> 
 
    </head> 
 
    <body> 
 
     <div id="tvWrapper" style="margin: 0px auto; width: 100%; transition: all 1s; -webkit-transition: all 1s;"> 
 
     <div style="width: 100%; margin: 0 auto; position: relative;"> 
 
      <div style="background: url('http://s28.postimg.org/3xquvgh31/TVtop.png') no-repeat; background-size: 100% 100%; width: 100%; height: 8px; z-index: 2;"></div> 
 
      <div style="background: url('http://s28.postimg.org/3py61tzst/TVleft.png') no-repeat; background-size: 100% 100%; float: left; width: 8px; padding-bottom: 56.25%; position: absolute; z-index: 2;"></div> 
 

 
      <div style="float: left; width: calc(100% - 8px); padding-bottom: 56.3%; position: relative; z-index: 1;">  
 
      <div id="myElement" style="position: absolute; width: 100%; height: 100%; margin: 0 auto;border: 0;"></div> 
 
      <script type="text/JavaScript"> 
 
       var playerInstance = jwplayer("myElement"); 
 
       playerInstance.setup({ 
 
       file: "http://ads.memo2.nl/banners/defensie/2016/Veteranendag/Dominique.mp4", 
 
       aspectratio: "16:9", 
 
       width: "100%", 
 
       skin: { 
 
        name: "roundster", 
 
        active: "#add136", 
 
        inactive: "#bbb7b7", 
 
        background: "white" 
 
       } 
 
       }); 
 
      </script> 
 
      </div> 
 

 
      <div style="background: url('http://s3.postimg.org/vzf09qvk3/TVright.png') no-repeat; background-size: 100% 100%; float: right; width: 8px; padding-bottom: 56.25%; position: absolute; right: 0; z-index: 2;"></div> 
 
      <div style="background: url('http://s24.postimg.org/fxwbp4pv9/TVbottom.png') no-repeat; background-size: 100% 100%; width: 100%; padding-bottom: 8%; clear: both; z-index: 2;"></div> 
 
     </div> 
 
     </div> 
 
    </body> 
 
    </html>

正如你可以看到它的反應,不過這臺電視機的底部,在瀏覽器的底部。有沒有簡單的方法來解決這個問題?

如果我放入一個iFrame,接下來發生的事情是電視機底部正好放在電視機的頂部。

例子: http://ads.memo2.nl/Jeroen/2016/TestingPlz.html

table { 
 
    font-size: 0; 
 
} 
 
iframe { 
 
    width: 100%; 
 
    max-width: 1000px; 
 
    min-height: 700px; 
 
}
<iframe src="http://ads.memo2.nl/Jeroen/2016/TVTest.html" frameborder="0" scrolling="no"></iframe>

我的想法是讓iFrame中的電視響應,與TVbottom.png但隨後在底部。

+0

爲什麼不使用引導程序的用戶界面? – Developer

回答

2

嘗試刪除:

padding-bottom: 56.3%; 

來自包裝JW Player目標元素(#myElement)的DIV

+0

這個作品完美! –

0

從所有div中刪除填充,

只保留最後一個的

<div style="background: url('http://s24.postimg.org/fxwbp4pv9/TVbottom.png') no-repeat; background-size: 100% 100%; width: 100%; padding-bottom: 8%; clear: both; z-index: 2;"></div> 

在這裏看到: - http://codepen.io/ravu/pen/oLZZJy