A workaround for mobile end Position:fixedbug

Source: Internet
Author: User

Reason: Mobile phone activates the soft keyboard, fixed positioning will appear element position drift

WORKAROUND: Use fixed positioning at the bottom of the head, use absolute in the middle body section, and set top and bottom values to the top bottom height.

Specific code:

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Home</title><Metaname= "Viewport"content= "Width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" /><Metaname= "Renderer"content= "WebKit"><styletype= "Text/css">HTML{font-size:40px;}Body{position:Absolute; Left:0;width:100%;Height:100%;Overflow-x:Hidden;margin:0;font-size:. 34rem;text-align:Center;Line-height:3rem;Color:#fff;}. Head,.footer{position:fixed; Left:0;background:#4d406b;Height:. 9rem;width:100%;}. Head{Top:0;}. Content{position:Absolute; Left:0;Top:. 9rem;Bottom:. 9rem;overflow-y:Scroll;width:100%;Background-color:Blue;}. Footer{Bottom:0;}</style></Head><Body><Divclass= "Head"></Div><Divclass= "Content">I am the text<BR>I am the text<BR>I am the text<BR>I am the text<BR>I am the text<BR>I am the text<BR>I am the text<BR>I am the text<BR>I am the text<BR></Div><Divclass= "Footer"></Div></Body></HTML>

A workaround for mobile end Position:fixedbug

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.