html - 适合屏幕的 iframe

标签 html wordpress iframe blogs

我正在尝试整合 my blog通过 iframe 进入我的网站。但是,使用这种方法我必须以像素为单位给出高度和宽度。不过,我希望博客适合屏幕。有什么办法吗?

编辑:下面的答案建议我更改我的 CSS。那么我该如何处理 html 中的“width”和“height”变量呢?这是页面的完整 html 代码。

<!DOCTYPE html>
<html>

<head>
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<title>Shiloh Janowick's Blog!</title>
	<link rel="shortcut icon" href="pics/favicon.ico" type="image/x-icon">
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />
</head>

<body>

	<iframe width="" height="" src="http://shilohgameblog.wordpress.com" frameborder="0" allowfullscreen></iframe>

</body>

</html>

我没有指定宽度和高度,因为我不知道之后要放什么。

最佳答案

试试这个。 它对我很有用。

    body {
        margin: 0;
        padding: 0;
    }

    iframe {
        display: block;
        width: 100vw;
        height: 100vh;
        max-width: 100%;
        margin: 0;
        padding: 0;
        border: 0 none;
        box-sizing: border-box;
    }

关于html - 适合屏幕的 iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34828590/

相关文章:

css - 无论我尝试什么,标题都不会改变颜色

php - 用于更改编辑帖子作者框中的作者列表的 WordPress 过滤器

javascript - 在两个整页上打印两个图像

jquery - 如果预加载了 iframe,则在具有 onclick 功能的 iframe 中应用 css 样式仅在第一次单击时有效

html - 使用 CSS,如何将元素锚定到基线并根据另一个 "pinned"元素调整其大小?

html - 以另一种颜色更改选择选项时出现问题

php - 向 Wordpress 主题添加子菜单

ios - 无法在 iPad 上播放 iFrame 嵌入式 YouTube 视频

javascript - 限制数组中的随机元素显示在图像标签中

javascript - View 更改时 Backbone 重新加载 slider ?