当前位置:网站首页>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)

边栏推荐
- VTK image sequence mouse interactive flipping
- itk 多分辨率图像 itk::RecursiveMultiResolutionPyramidImageFilter
- Newoj week 10 question solution
- Async/await for ES6
- R language Visual facet chart, hypothesis test, multivariable grouping t-test, visual multivariable grouping faceting bar plot, adding significance level and jitter points
- ITK Examples/RegistrationITKv4/DeformableRegistration
- C语言进阶篇——万字详解指针和qsort函数
- When to use binary search
- 号称下一代监控系统!来看看它有多牛逼
- 嵌入式系统硬件构成-基于ARM的嵌入式开发板介绍
猜你喜欢

unittest框架

El select data echo, display only value but not label

从基础到源码统统帮你搞定,技术详细介绍

C语言进阶篇——深度解剖数据在内存中的存储(配练习)

OpenMAX (OMX)框架

Five ways to quickly download large files from Google cloud disk

八大误区,逐个击破(2):性能差?应用程序少?你对云的这些担心很多余!

A "murder case" caused by ES setting operation

Image comparison function after registration itk:: checkerboardimagefilter

分享PDF高清版,系列篇
随机推荐
Typescript and abstract classes
itkMultiResolutionImageRegistrationMethod
嵌入式系统硬件构成-基于ARM的嵌入式开发板介绍
[you code, I fix] whitesource was officially renamed mend
itk::SymmetricForcesDemonsRegistrationFilter
深度学习的多个 loss 是如何平衡的?
Summary of knowledge points of ES6, ES7, es8, es9, ES10, es11 and ES12 (interview)
Jacobian matrix IK of manipulator
ITK multi-stage registration
三维坐标点拟合球(matlab and C )
[an Xun cup 2019]iamthinking
快速下载谷歌云盘大文件的5种方法
Object value taking method in JS And []
The 4th Zhejiang CTF preliminary contest web pppop
Attack and defense world re (New 1 hand zone) questions 1-12
嵌入式系统硬件构成-嵌入式系统硬件体系结构
Differences and recommended uses of VaR, let and const (interview)
Pytorch官方Faster R-CNN源代码解析(一)——特征提取
2022 ARTS|Week 23
Async/await for ES6