如何在IE10 Mobile中制作固定的div?

时间:2013-01-06 19:19:58

标签: html css windows-phone windows-phone-8 internet-explorer-10

如何在Windows Phone 8上制作适用于IE10 Mobile的固定div?我目前使用的代码是:

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

这只是部分有效。当用户滚动时,div滑回其原始位置。它在横向方向上根本不起作用。有没有其他方法可以使Internet Explorer 10移动设备支持的固定div不移动?

1 个答案:

答案 0 :(得分:5)

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;