Archived

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

  • 0

Centering Content Div


Question

Posted · Report post

So I am having an issue, this works in some browsers, but not in others. My screen looks fine, but not sure why it I have to do it this way....

 

div.content {
  padding-left: 56px;
  position:relative;
}

Any idea if I can float it to the center instead of adding a padding?

 

div_content.png

Share this post


Link to post
Share on other sites

6 answers to this question

Posted · Report post

That still messes it up, everything moves to the left outside of where the div should be.

 

div_content_fix.png

Share this post


Link to post
Share on other sites

Posted · Report post

Anthony,

 

If you look for these elements and adjust from this example, I think you'll find some success:

 

.main_nav_container.nosearch, .nosearch .main_nav {
    margin-left130px;
    margin-rightauto;
    positionrelative;
}
.navigation_wrap .main_nav_container {
    floatnone;
    width100%;
}
 
The margin-left above obviously will depend on various factors so it clearly needs individual adjustment.

Share this post


Link to post
Share on other sites

Posted · Report post

Do you have a link to your site?

 

Also, remove any custom CSS you have added related to your navigation menu, then the code I provided should work, just tested it on a test site of mine and worked as intended.

Share this post


Link to post
Share on other sites

Posted · Report post

Not quite! But thanks Batman!

Share this post


Link to post
Share on other sites

Posted · Report post

You're using the Nav Classic navigation section, the code on the post Batman linked is for the NavBar section. Use the code below instead.

 

#site .navigation_wrap .main_nav { margin-right: 0; }
#site .main_nav ul { text-align: center; float: none; }
#site .main_nav ul > li { float: none; display: inline-block; }

Share this post


Link to post
Share on other sites