问题
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>
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?
回答1:
div
{
position:fixed;
width:100%;
background:blue;
top:0; /* bottom:0 */
left:0; /* right:0 */
height:200px; /* You can specify here as you want */
}
When Using position:fixed
, you have to give atleast one side declaration. That where it should be remain fixed e.g. top:0;
来源:https://stackoverflow.com/questions/14185811/how-to-make-a-fixed-div-in-ie10-mobile