微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使html页面自动适合移动设备屏幕?

我使用< iframe>在html页面上放置了一个Formidable Form,但我希望它能在移动设备上全屏显示.到目前为止,我使用以下代码
<!DOCTYPE html>
<html>
<head>
<Meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <style>
  @import url(http://fonts.googleapis.com/css?family=Londrina+Sketch);

  body {
  background-color: #f3eedd;
  width: 750px;
  overflow:scroll;
    overflow-x:hidden;
  }

h2 {
    font-size: 20px;
    color: #c13e18;
    margin: 10px 30px 10px 30px;
}

</style>
</head>
<body>
<div id="header">
<h2>Book Supheroes Unite</h2>
</div>
<div id="form">
<iframe src="http://challenge-the-Box.com/wp-admin/admin-ajax.PHP?action=frm_forms_preview&form=sbyrt02
" frameborder="0" scrolling="no" style="width:280px;height:535px;"></iframe></div>
</html>

我相信它与视口有关?但是,我对此并不完全确定!

解决方法

<Meta name="viewport" content="width=device-width,initial-scale=1.0">

此元标记允许您定位移动设备并将宽度设置为屏幕大小.

文档提供here!

还可以考虑迁移到引导响应式网页设计的CSS框架! Twitter Bootstrap

原文地址:https://www.jb51.cc/html/225154.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐