2014-11-06 87 views
1

如何將embed標籤的大小強制爲div標籤的大小,我可以將embed標籤的大小更改爲div標籤的大小,但是我希望獲得embed標籤的完全reslotion(embed標籤用於網絡攝像頭)如何將嵌入標籤的大小強制爲div標籤的大小?

<div style="background-color: #111; width: 80%; height:500px; margin-left: auto; margin- ight: auto; ">  

<embed id="webcam_movie" wmode="Transparent" src="../Scripts/webcam.swf" loop="false" menu="true" quality="best" bgcolor="#ffffff" name="webcam_movie" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="shutter_enabled=1&amp;shutter_url=../Scripts/shutter.mp3&amp;width=800&amp;height=600&amp;server_width=800&amp;server_height=600" height="600" width="800" align="middle"> 

</div> 
+0

就採用相同的樣式? – nicael 2014-11-06 22:59:59

回答

1

您可以使用DIV嵌入這一招包裹並定義CSS規則

<head> 
    <style> 
    .flash-container { 
     height: 0; 
     overflow: hidden; 
     padding-bottom: 56.25%; 
     padding-top: 30px; 
     position: relative; 
    } 
    .flash-container embed { 
     height: 100%; 
     left: 0; 
     position: absolute; 
     top: 0; 
     width: 100%; 
    } 
    </style> 
    </head> 
    <body> 
    <div class="flash-container" style="background-color: #111; width: 80%; height:500px; margin-left: auto; margin-right: auto; ">  

    <embed id="webcam_movie" wmode="Transparent" src="../Scripts/webcam.swf" loop="false" menu="true" quality="best" bgcolor="#ffffff" name="webcam_movie" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="shutter_enabled=1&amp;shutter_url=../Scripts/shutter.mp3&amp;width=800&amp;height=600&amp;server_width=800&amp;server_height=600" height="600" width="800" align="middle"> 

    </div> 
    </body>