Jump to content

CSS Center


sseeley

Recommended Posts

First, lose any "position:absolute" elements, they will not help you in the least.

 

Next, you must specify a width in px or percentage or it doesn't work. For centering it is usually just "margin:0 auto". But you want 50px top margin so (I use 500px for example):

<style>
#menuBar {
    width: 500px;
    margin:50px auto 0 auto;
}
</style>
<body>
<div id="menuBar">Your content here</div>

Link to comment
https://forums.phpfreaks.com/topic/150499-css-center/#findComment-790887
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.