如何在IE10移动版中设置固定的div? [英] How to make a fixed div in IE10 Mobile?

查看:253
本文介绍了如何在IE10移动版中设置固定的div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Windows Phone 8上制作与IE10 Mobile兼容的固定div?我当前使用的代码是:

How do you make a fixed div that works with IE10 Mobile on Windows Phone 8? The code I am currently using is:

<div style="position:fixed;width:100%;background-color:blue;">
    test
</div>

这仅部分起作用.当用户滚动时,div滑回其原始位置.它在横向也不起作用.有没有其他方法可以使Internet Explorer 10移动版支持不移动的固定div?

This only partially works. When the user scrolls, the div slides back into its original position. It also does not work at all in landscape orientation. Are there any alternative ways to make a fixed div that does not move that are supported on Internet Explorer 10 mobile?

推荐答案

div 
{
    position:fixed;
    width:100%;
    background:blue;
    top:0; /* bottom:0 */
    left:0; /* right:0 */
    height:200px; /* You can specify here as you want */
}

使用position:fixed时,必须至少给出一侧声明.应该固定的地方,例如top:0;

When Using position:fixed, you have to give atleast one side declaration. That where it should be remain fixed e.g. top:0;

这篇关于如何在IE10移动版中设置固定的div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆