html - 做h5全屏的活动页面的时候。 设计师通常是给iphone6尺寸的设计稿。那么如何在大多数手机上适配啊?
巴扎黑
巴扎黑 2017-04-17 11:55:01
0
13
1520

全屏h5动画活动页面. 给的是750的尺寸设计稿.

我采用的是rem方案. 那现在的问题是. 按照设计稿的标注去写css.

内容宽度的话不会有问题. 但高度有问题呀.. 因为有些浏览器会有地址栏和工具栏.

会占据一些高度. 这时候你按照设计稿上标注写出来的页面. 在高度上都挤在一起或放不下了...

因为要全屏.......

有没有什么优雅的解决办法. 在不改设计稿的情况下呢...

巴扎黑
巴扎黑

reply all(13)
黄舟

Since it is a full-screen page, you need to apply for full-screen permission, or make a judgment and if it is not full-screen, do not display it and remind the user to turn on full-screen.
In addition, most H5 pages are now mainly displayed on WeChat, so just adapt to WeChat.

刘奇

Do media queries, percentage layout or rem, em can be done

大家讲道理

Just use percentage for height

迷茫

Media query or percentage layout

小葫芦

Recommend a basic adaptation method
head join

<meta name="viewport" content="width=640,user-scalable=no,target-densitydpi=device-dpi,minimal-ui">

Among them, width = width of the design draft, and then the entire page can basically be positioned according to the px of the design draft. Small screens are more troublesome. For example, the iPhone 4s will miss the bottom, so the design element content still needs to be considered. If the content can Just ignore the ones presented by sliding

洪涛

A usage I saw before is to use padding-top for height adaptation, which means that the content must be absolutely positioned. Can be used as needed.

PHPzhong

Use rem when writing CSS, and then dynamically change the value of rem

黄舟

https://segmentfault.com/a/11...
https://segmentfault.com/a/11...

刘奇

Taobao flexible.js

左手右手慢动作

Try to use vw percentage
calc(100vw - 20px) which is easy to solve

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template