我正在尝试整合 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/