在HTML5中,iframe具有"无缝"等新属性,应删除边框和滚动条.我已经尝试了但似乎没有用,我仍然可以看到滚动条和边框(我使用谷歌浏览器作为浏览器),这是我的代码:
<iframe seamless="seamless" title="google" width="600" height="300" src="http://www.google.co.uk"></iframe>
Run Code Online (Sandbox Code Playgroud)
知道为什么它不起作用吗?
还有一个问题是,是否可以在iframe中定位页面的特定部分?
我们有这个小组项目,我被指派做一个iframe可调整大小.自上周以来,我一直在阅读很多论坛帖子,我发现iframe自己无法调整大小.
有没有办法让我的iframe可调整大小?
我想使用以下CSS动态调整IFRAME:
#myiframe {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
Run Code Online (Sandbox Code Playgroud)
但是,没有浏览器似乎支持这一点.
在良好的浏览器中,我可以使用引用的CSS样式将IFRAME包装在DIV中,并将IFRAME的高度和宽度设置为100%.但这在IE7中不起作用.没有使用CSS表达式,有没有人设法解决这个问题?
更新
MatTheCat回答了一个场景,如果IFRAME直接位于正文下方且body/html标签的高度为100%,则该场景有效.在我最初的问题中,我没有说明IFRAME的位置以及适用于它的容器的样式.希望以下解决这个问题:
<html>
<body>
<div id="container"><iframe id="myiframe"></iframe></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
让我们假设以下容器CSS:
#container {
position: absolute;
top: 10px;
bottom: 10px;
left: 10px;
right: 10px;
}
Run Code Online (Sandbox Code Playgroud)
如果您现在放在height: 100%IFRAME上,它将无法正确调整大小.
我需要做以下事情:
任何人都可以帮忙吗?
我不能用的东西:
位置:固定;(主要是由于我用于侧边栏的脚本
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Bus Management System</title>
<!-- Viewport meta tag to prevent iPhone from scaling our page -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function(){
var iFrames = $('iframe');
function iResize() {
for (var i = 0, j = iFrames.length; i < j; i++) {
iFrames[i].style.height = iFrames[i].contentWindow.document.body.offsetHeight + 'px';}
}
if ($.browser.safari || $.browser.opera) {
iFrames.load(function(){
setTimeout(iResize, 0);
});
for (var i = 0, j = …Run Code Online (Sandbox Code Playgroud) 有没有办法让高度<iframe>达到页面的底部?通过使用很难判断height:xx%,它可能依赖于浏览器.
代码如下:
<!DOCTYPE html>
<html>
<body style="margin:0">
<p style="margin:10px"> hello </p>
<iframe src="http://www.weather.com" style="width:100%; height:95%"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我想谷歌地图iframe占据100%的高度,截至目前它只有150px左右.编码如下图所示,我该怎么办,请帮帮我.
<iframe width="67%" height="100%" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.in/maps?f=q&
source=s_q&
hl=en&
geocode=&
q=Prabhakar.C,+ICON+Design+Studio,+sathy+road,+Ganapathy,+87-A,+First+floor,+muniappakoil+thottam,,+Coimbatore,+Tamil+Nadu&aq=1&sll=21.125498,81.914063&sspn=55.331887,107.138672&
ie=UTF8&
hq=Prabhakar.C,+ICON+Design+Studio,+sathy+road,+Ganapathy,+87-A,+First+floor,+muniappakoil+thottam,,&hnear=Coimbatore,+Tamil+Nadu&t=m&
ll=11.041457,76.983948&
spn=0.080872,0.109863&
z=13&iwloc=A&
output=embed">
</iframe>
Run Code Online (Sandbox Code Playgroud) 以下是一些有关堆栈溢出的主题:
我想将iframe嵌套在我的网页上。我正在使用引导程序来设置网页样式,因此我使用了以下代码:
<div class="col-sm-6" style="margin:0px;padding:0px;overflow:hidden">
<iframe id="iFrame1" src="<test_link_here>" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%"></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)
不幸的是,我的iframe尚未调整为完整高度。我想以某种方式自动将其调整为最大高度。你知道我能做到吗?
iframe ×6
css ×5
html ×4
javascript ×2
attributes ×1
css-position ×1
css3 ×1
height ×1
html5 ×1
jquery ×1
resizable ×1
styles ×1