【CSS】Google Map崁入響應式網頁(RWD)

為了要適應不同頁面大小及瀏覽裝置設備,需利用CSS來控制。iframe位置連結可透過Google Map產生,不在本篇討論之。本篇iframe位置連結因涉及隱私,故假資料填入。

部分HTML(參考)︰
<div class="iframe-rwd">
<iframe src="https://www.google.com/maps/embed?pb=xxxxxxxxx888888.777777" width="800" height="600" frameborder="0" style="border:0;" allowfullscreen="" aria-hidden="false" tabindex="0"></iframe>
</div>

CSS(參考)︰
<style type="text/css">
/* google map for RWD */
.iframe-rwd {
position: relative;
padding-bottom: 50%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.iframe-rwd iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>

大螢幕執行畫面︰


 

小螢幕執行畫面︰



留言

這個網誌中的熱門文章

【ASP】日期轉換(西元<-->民國)

【VB】使用NPOI元件來匯出Excel--DataTableToExcel

【SQL】符號切割字串變成多欄