当前位置:网站首页>How to adapt the page size when iframe is embedded in a web page
How to adapt the page size when iframe is embedded in a web page
2022-06-12 12:51:00 【Five flower hourglass】
Problem description :
There is a container in the page div, With width and height attribute . stay div Embed a iframe page , Present this effect :
You can see that only part of the embedded page is exposed .
And we hope : Embedded pages can be completely displayed in containers .
Ideas : utilize CSS Of transform, Zoom the page .
1、 The resolution of the computer screen I developed is 1920 x 1080, On this basis , Set up iframe The width and height of .
2、iframe Parent element of div The width and height of is the width and height of the screen 50%, therefore transform: scale(0.5) This number is 0.5.( The remaining three attributes have nothing to say , Search if you don't understand W3C Well …)
3、 What should be noted is , Better give div Add one overflow: hidden; Properties of , Because sometimes your div The width and height are not exactly scaled as they are now 50%.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>iframe When embedding a web page , How to adapt the page size </title>
</head>
<style> html, body {
width: 100%; height: 100%; } body {
background-color: rgb(228, 228, 228); overflow: hidden; } * {
margin: 0px; padding: 0px; } .iframediv {
width: 50%; height: 50%; margin: 100px auto; border: 10px dashed rgb(58, 58, 58); overflow: hidden; } .iframediv iframe {
width: 1920px; height: 1080px; top: 0; left: 0; transform-origin: top left; transform: scale(0.5) } </style>
<body>
<div class="iframediv">
<iframe src="http://www.hewebgl.com/" frameborder="0"></iframe>
</div>
</body>
</html>
effect :

my div Width and height are 50% The situation of ,transform: scale(0.5) yes 0.5, The effect is shown above .
Then suppose my div wide 40%, high 60% The situation of , How to deal with it ?
There are two kinds of :
1、transform: scale(0.4, 0.6)

2、transform: scale(0.4)

边栏推荐
- 深度剖析指针的进阶——C语言的进阶篇
- 442 authors, 100 pages! It took Google 2 years to release the new benchmark big bench | open source
- Embedded system hardware composition - embedded system hardware architecture
- Itk:: neighborhood get 6 neighborhood, 18 neighborhood, 26 neighborhood, 18/6 neighborhood, 26/18 neighborhood
- Hardware composition of embedded system - introduction of embedded development board based on ARM
- ITK multiresolution image itk:: recursivemultiresolutionpyramidimagefilter
- 八大误区,逐个击破(2):性能差?应用程序少?你对云的这些担心很多余!
- Robot Jacobian solution
- 嵌入式系统概述2-嵌入式系统组成和应用
- 构建嵌入式系统软件开发环境-建立交叉编译环境
猜你喜欢

itk itk::BSplineDeformableTransform

What is the function tag? Article to understand its role and its best practices

itk 多分辨率图像 itk::RecursiveMultiResolutionPyramidImageFilter
![VNCTF2022 [WEB]](/img/36/a70763d74e503ddc888b8fc38f8677.jpg)
VNCTF2022 [WEB]

二叉树(序列化篇)

Object. Detailed explanation of assign()

什么时候运用二分搜索

Known as the next generation monitoring system! See how awesome it is

Eight misunderstandings are broken one by one (2): poor performance? Fewer applications? You worry a lot about the cloud!

Embedded system hardware composition - embedded system hardware architecture
随机推荐
嵌入式系统概述2-嵌入式系统组成和应用
二叉树(序列化篇)
Differences and recommended uses of VaR, let and const (interview)
【您编码,我修复】WhiteSource正式更名为Mend
Attack and defense world re (New 1 hand zone) questions 1-12
Microsoft Word 教程,如何在 Word 中插入页眉或页脚?
三维坐标点拟合球(matlab and C )
ITK multi-stage registration
Typescript and abstract classes
Introduction, installation and use of core JS
this.$ How to solve the problem when refs is undefined?
大一女生废话编程爆火!懂不懂编程的看完都拴Q了
Mui login database improvement and Ajax asynchronous processing [mui+flask+mongodb+hbuilderx]
VTK three views
Buu question brushing record - 6
VGA显示彩条和图片(FPGA)
安全KNN
The 4th Zhejiang CTF preliminary contest web pppop
R语言ggplot2可视化:使用ggrepel包在线图(line plot)的尾端那个数据点添加数值标签(number label)
R language Visual facet chart, hypothesis test, multivariable grouping t-test, visual multivariable grouping faceting bar plot, adding significance level and jitter points