Full-screen iframe with a height of 100%

前端 未结 17 1251
星月不相逢
星月不相逢 2020-11-22 04:35

Is iframe height=100% supported in all browsers?

I am using doctype as:



        
17条回答
  •  -上瘾入骨i
    2020-11-22 05:23

    Another way to build fluid full screen iframe:


    Embedded video fills entire viewport area when page loads

    Nice approach for landing pages with video or any embedded content. You can have any additional content below of embedded video, which is revealed when scrolling page down.

    Example:

    CSS and HTML code.

    body {
        margin: 0;
        background-color: #E1E1E1;
    }
    header {
        width: 100%;
        height: 56vw;
        max-height: 100vh;
    }
    .embwrap {
        width: 100%;
        height: 100%;
        display: table;
    }
    .embwrap .embcell {
        width: auto;
        background-color: black;
        display: table-cell;
        vertical-align: top;
    }
    .embwrap .embcell .ifrwrap {
        height: 100%;
        width: 100%;
        display: inline-table;
        background-color: black;
    }
    
    .embwrap .embcell .ifrwrap iframe {
        height: 100%;
        width: 100%;
    }

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis lorem orci, rhoncus ut tellus non, pharetra consequat risus.

    Mauris aliquet egestas odio, sit amet sagittis tellus scelerisque in. Fusce in mauris vel turpis ornare placerat non vel purus. Sed in lobortis

提交回复
热议问题