2013-10-18 21 views
0

我正在努力如何將<div>放在視頻的頂部<object>在視頻頂部放置一個div <object>在HTML CSS中

藍色邊框是我的。在視頻後面是我的<div class="title">some text</div>,我想要在視頻的頂部並將其置於右下方。

enter image description here

CSS和HTML

<style type="text/css"> 
.title { 
    height:50px; 
    width:150px; 
    border:1px solid #000; 
    position:absolute; 
    z-index:10; 
    background-color:pink; 
    top:260px;left:0; 
} 
iframe { 
    width:490px; 
    height:400px; 
    position:absolute; 
    z-index:1; 
    border:2px solid blue; 
} 
</style> 
<body> 
<div id="wrap" style="position:relative;"> 
    <div class="title"> 
     <h1>some text</h1> 
    </div> 

<iframe src="owlvid.html"></iframe> 
</div> 
</body> 

這是裏面的對象我owlvid.html

<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" 
    codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" 
    width="480" height="300" id="vlc" events="True"> 

    <param name="Src" value="owl-vid-path-source" /> 
    <param name="ShowDisplay" value="True" /> 
    <param name="AutoLoop" value="False" /> 
    <param name="AutoPlay" value="True" /> 
    <param name="wmode" value="transparent" /> 

    <embed id="vlcEmb" type="application/x-google-vlc-plugin" version="VideoLAN.VLCPlugin.2" autoplay="yes" loop="no" width="480" height="300" 
    target="owl-vid-path-source" ></embed> 

</OBJECT> 
+0

它似乎工作^ h ere ... http://jsfiddle.net/uhRBN/ –

+0

嘗試了很多次,但仍然不會爲我工作。我真的不知道你的工作方式。 : -/ – bobbyjones

+0

我注意到iframe src是針對YouTube視頻的。但我需要定位一個帶有頁面的HTML頁面。 – bobbyjones

回答

0

試試這個:

<style type="text/css"> 
#wrap { 
    position: absolute; 
    width: 492px; 
} 
.title { 
    background-color: #FFC0CB; 
    border: 1px solid #000000; 
    height: 50px; 
    width: 100%; 
} 
.title h1 { 
    float: right; 
    line-height: 1; 
    margin-right: 10px; 
    margin-top: 0; 
    position: relative; 
    top: 25%; 
} 
iframe { 
    border: 2px solid #0000FF; 
    height: 400px; 
    padding-top: 50px; 
    position: absolute; 
    top: 0; 
    width: 490px; 
} 
</style> 
<body> 
    <div id="wrap"> 
    <div class="title"> 
     <h1>some text</h1> 
    </div> 
    <iframe src="owlvid.html"></iframe> 
    </div> 
</body> 
+0

我試過,但仍沒有工作。任何想法爲什麼?該div仍然在視頻後面'' – bobbyjones

+0

@ user1933824請參閱我的最新版本,並告訴我這是否與您正在尋找的內容更接近。 – jerdiggity

+0

也許給我們想要在視頻上方的元素添加'z-index:50;'應該就足夠了。 – versvs

相關問題