joesphspojhan
joesphspojhan

Reputation: 13

CSS floating div?

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%;
}

Upvotes: 1

Views: 7224

Answers (2)

Phil
Phil

Reputation: 11175

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

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

Upvotes: 3

ayyp
ayyp

Reputation: 6598

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.

Upvotes: 4

Related Questions