开发者

CSS floating div?

开发者 https://www.devze.com 2023-03-23 11:45 出处:网络
This isn\'t that big of an issue but its been bugging me I wanted the div in the center of the top of the page, but the code I have won\'t let it stay there when the user scrolls. Any ideas on how to

This isn't that big of an issue but its been bugging me

I wanted the div in the center of the top of the page, but the code I have won't let it stay there when the user scrolls. Any ideas on how to fix this?

background: none repeat scroll 0 0 #2B88C2;
    border: 1px solid rgba(0, 0, 0, 0.3);
    bottom:0px;
    font-family: Arial, Helvetica, sans-serif;
  开发者_高级运维  height: 55px;
    padding-top: 10px;
    padding-bottom: 5px;
    position: top-fixed;
    text-shadow: 1px 1px 1px #000000;
    width: 70%;
}


Try doing position:fixed;, top:0; and getting rid of bottom:0;. That should make it stay at the top, then all you have to do is center it.


There is no 'top-fixed' - what you're going to need is

{
    position:fixed; 
    top:0;
    margin:0 auto
}
0

精彩评论

暂无评论...
验证码 换一张
取 消