html - iframe 的问题
问题描述
我正在尝试将一个临时项目嵌入到 GitHub 页面中。我有一些代码:
<!DOCTYPE html><head><title>Project-Zero | OS-ONE</title><link rel="icon" href="https://raw.githubusercontent.com/OS-ONE/Project-Zero/main/image2.png" type="image/x-icon"/></head><iframe style="margin-top:-56px; margin-left:-11px;" allowtransparency="false" width="100%" height="108%" bgcolor=#220000 src="https://scratch.mit.edu/projects/embed/468188401/" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
但由于某种原因,它显示如下: 有没有办法解决这个问题?我见过其他人和我有同样问题的人,但由于某种原因它不起作用。提前致谢!
解决方案
请尝试以像素为单位设置 with/height 并将 max-with:100% 设置为 iframe。
<!DOCTYPE html><head><title>Project-Zero | OS-ONE</title><link rel="icon" href="https://raw.githubusercontent.com/OS-ONE/Project-Zero/main/image2.png" type="image/x-icon"/></head><iframe style="max-width: 100%;" allowtransparency="false" width="1000" height="600" bgcolor=#220000 src="https://scratch.mit.edu/projects/embed/468188401/" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
推荐阅读
- ios - 无法在 Xcode 中找到设备支持文件
- android-studio - 无法在 Android Studio 中添加 Sonar Lint 和 SonarCube 插件
- php - 从以顺序名称存储的目录中检索图像并存储在数组中
- mysql - 尝试使用 mySQL Workbench 连接到 Amazon AWS 上的 mySQL 数据库
- ios - 在 NIB 中面临 CGAffineTransform 的问题
- javascript - 将数组中的最后一项返回到第一个位置
- node.js - 如何从 authoriz.net 获取未结算的交易列表?
- vue.js - V-tooltip: 从方法中关闭 Popover
- reactjs - 如何在我的组件中使用 getDerivedStatefromProps
- node.js - Active Directory/Ldap 获取 NodeJS 中特定属性的 DataType 或 Syntax