msb*_*sbg 2 html css windows-phone internet-explorer-10 windows-phone-8
如何在Windows Phone 8上制作适用于IE10 Mobile的固定div?我目前使用的代码是:
<div style="position:fixed;width:100%;background-color:blue;">
test
</div>
Run Code Online (Sandbox Code Playgroud)
这只是部分有效.当用户滚动时,div滑回其原始位置.它在横向方向上根本不起作用.有没有其他方法可以使Internet Explorer 10移动设备上支持的固定div不移动?
div
{
position:fixed;
width:100%;
background:blue;
top:0; /* bottom:0 */
left:0; /* right:0 */
height:200px; /* You can specify here as you want */
}
Run Code Online (Sandbox Code Playgroud)
使用时position:fixed,您必须提供至少一方声明.应该保持固定的地方,例如top:0;