How can I scale the content of an iframe?

前端 未结 17 2246
后悔当初
后悔当初 2020-11-22 11:46

How can I scale the content of an iframe (in my example it is an HTML page, and is not a popup) in a page of my web site?

For example, I want to display the content

17条回答
  •  青春惊慌失措
    2020-11-22 12:37

    I just tested and for me, none of the other solutions worked. I simply tried this and it worked perfectly on Firefox and Chrome, just as I had expected:

    and the css:

    .wrap {
        width: 640px;
        height: 480px;
        overflow: hidden;
    }
    
    iframe {
        width: 76.92% !important;
        height: 76.92% !important;
        -webkit-transform: scale(1.3);
        transform: scale(1.3);
        -webkit-transform-origin: 0 0;
        transform-origin: 0 0;
    }
    

    This scales all the content by 30%. The width/height percentages of course need to be adjusted accordingly (1/scale_factor).

提交回复
热议问题