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

边栏推荐
- Mui login database improvement and Ajax asynchronous processing [mui+flask+mongodb+hbuilderx]
- Binary tree (serialization)
- Buu question brushing record - 6
- 2022 ARTS|Week 23
- itk 多分辨率图像 itk::RecursiveMultiResolutionPyramidImageFilter
- Buu question brushing record - 7
- 机械臂雅可比矩阵IK
- Theoretical knowledge of improved DH parameters and standard DH parameters of manipulator
- itk neighbhood
- Uniapp wechat applet long press the identification QR code to jump to applet and personal wechat
猜你喜欢

C语言进阶篇——浮点型在内存中的存储

Vs2019 set ctrl+/ as shortcut key for annotation and uncomment

Overview of embedded system 3- development process, learning basis and methods of embedded system

Downloading and using SWI Prolog

Bitmap, bloom filter and hash sharding

深度剖析指针的进阶——C语言的进阶篇

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

C语言进阶篇——万字详解指针和qsort函数

常数时间删除/查找数组中的任意元素

什么时候运用二分搜索
随机推荐
C语言进阶篇——万字详解指针和qsort函数
深度学习的多个 loss 是如何平衡的?
Bitmap, bloom filter and hash sharding
Geek challenge 2021 Web
数组——二维数组的花式遍历技巧
itk itk::BSplineDeformableTransform
构建嵌入式系统软件开发环境-建立交叉编译环境
Dasctf Sept x Zhejiang University of technology autumn challenge Web
嵌入式系统概述3-嵌入式系统的开发流程和学习基础、方法
Micro task, macro task and event loop of JS
Array -- seven array topics with double pointer technique
Introduction and test of MySQL partition table
wx. Login and wx Getuserprofile simultaneous use problem
ITK multiresolution image itk:: recursivemultiresolutionpyramidimagefilter
[database] Navicat -- Oracle database creation
提升管道效率:你需要知道如何识别CI/CD管道中的主要障碍
C语言进阶篇——深度解剖数据在内存中的存储(配练习)
[an Xun cup 2019]iamthinking
One line of code to implement shell if else logic
路由信息的来源