HTML iframe如何居中显示(详解居中iframe的方法)
eee的方法。
一、使用CSS样式居中显示
e。具体方法如下:
style type="text/css"> e-wrapper { : absolute;
top: 50%;
left: 50%; sformslate(-50%, -50%);
}
/style> e-wrapper"> eplee>
/div>
esforme-wrapper元素向上和向左移动50%的宽度和高度,使其居中显示。
二、使用JavaScript居中显示
e。具体方法如下:
script type="text/javascript"> ctionterIframe() { eententByIdye"); eWidthe.offsetWidth; eHeighte.offsetHeight; WidthdownerWidth; HeightdownerHeight; eWidtheWidth) / 2 + "px"; eHeighteHeight) / 2 + "px";
} dowloadction() { terIframe();
} dowresizection() { terIframe();
}
/script> e-wrapper"> eyeplee>
/div>
terIframeeee的left和top值,使其居中显示。
terIframee的位置,以保证其始终居中显示。
ee居中显示的问题。但是,在实际应用中,我们需要根据具体情况选择合适的方法。
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: HTML iframe如何居中显示(详解居中iframe的方法)
本文地址: https://pptw.com/jishu/70782.html
