我正在为应用程序开发一种视觉模拟器。如何在html中将div附加到特定维度
这里是我想什么:
上面的影像是一个iphone线框。我想在iphone屏幕的边界内插入一个div或任何其他元素。
我搜索了iframe。但html5不支持滚动视图。所以我正在寻找一种方式来做另一种方式。
我使用引导程序3并希望它是响应(FYI)。
编辑 所以,我想Soviut的回答是:
这是我的HTML的一部分:
<div id="page" class="row">
<div id="iOS" class="col-md-6">
<div id="iphone-wireframe" class="container">
<div class="content">
<h1>This is heading</h1>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
<p>This is some content This is some content This is some content This is some content This is some
content This is some content This is some content This is some content.</p>
</div>
</div>
</div>
我还调整了CSS,使之更适应用百分比等,并通过模仿img响应的特点。我的CSS的
部分:
.container {
width: 65%;
height: 90%;
margin-top: 40px;
background-image: url("/assets/res/img/iPhone-wireframe.png");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
.content {
margin: 81px auto auto;
width: 67.5%;
height: 75.5%;
background: #FFF;
overflow: auto;
}
结果是完美的,当它被调整了。它也具有响应能力,但图像和文本无法同步响应。我不知道如何用言语解释这个所以我就用图片显示:
任何示例代码?你有什么尝试?我们不会为你编码,如果你尝试了这个,发布你的尝试 –
我确实提到过我认为iframe和根据w3schools文档它不支持HTML 5中的滚动。我不问任何人给我代码为此,我只是要求正确方向的指针或想法。如果你确实感觉到了,我会编辑我的问题。 – GauravPandey
@AdamBuchananSmith:在Soviut的回答帮助下,我试图更新我的问题。 – GauravPandey