Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8679111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:53:20+00:00 2026-06-12T20:53:20+00:00

I have a set of divs that I have set to float:left and I

  • 0

I have a set of divs that I have set to float:left and I am wanting them to all be in line with each other but still be centered, this is what I currently have:

HTML

<div style="display: inline; text-align:center;">
    <div id="generalmenu">
        test
    </div>
    <div id="generalmenu">
        test
    </div>
    <div id="generalmenu">
        test
    </div>
</div>

CSS

#phonicmenu { 
    background: white; 
}
#generalmenu { 
    background: white; 
    width:270; 
    padding: 25px; 
    float:left; 
    margin-left: auto; 
    margin-right: auto; 
}

Any idea on how I can center these menus?

EDIT:
Added a JS Fiddle with a body so you can see the problem clearer.
http://jsfiddle.net/aYWwM/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:53:22+00:00Added an answer on June 12, 2026 at 8:53 pm

    The problem is also that you are using divs for purposes they aren’t made for. A div is a block element. You want to display stuff as inline elements, so you should use span or an unordered list.

    To do what you need, simply create a wrapping div and have its margin-left and margin-right set to auto. The wrapper should contain inline elements of what you need… See this jsFiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 4 divs that are set to float left but the end div
I have a set of divs that represent story categories. In each category, there's
Hi all I have problem with my div's in html. I have set them
I have an HTML file that has a set of divs with the class
I'd like to place two divs next to each other. The first of them
Basically I have a set of divs that are pretty much identical in structure,
I have one issue with floating divs. I would like to set all divs
Doing some jquery animation. I have certain divs set up with an attribute of
I have the following function set up to sequentially fade in divs (with class
I have set the eclipse java formatter to wrap lines that exceed 120 characters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.