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 8370917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:01:46+00:00 2026-06-09T14:01:46+00:00

Hi I have a container in witch there will be added multipe elements so

  • 0

Hi I have a container in witch there will be added multipe elements so I don’t really know what the width of the container will be because the elements are added dynamicly.I need this container to be centered so I figure that I should use display:inline-block to make the div width and height to be set acording to it’s elements but after I use this the property margin:0 auto does not work anymore.This is a simple example of what I am trying to achive:

<div> 
      <ul>
           <li>All</li>
           <li>Web Design</li>
      </ul>
</div>


div{
      display:inline-block;
      margin:0 auto;
}

No matter how many elements are in that container I want it to be centered.My curent atempt does not work so how can I center this container?

  • 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-09T14:01:48+00:00Added an answer on June 9, 2026 at 2:01 pm

    You can do it by adding a wrapper div that has display block and setting text-align:center to it:

    <div id="wrapper">
        <div> 
          <ul>
               <li>All</li>
               <li>Web Design</li>
          </ul>
    </div>
    </div>​
    
    div#wrapper{
        text-align:center; 
        display:block;    
    }
    div{
          display:inline-block;
          margin:0 auto;
    }​
    

    see this fiddle.

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

Sidebar

Related Questions

I have a container (div) with a background image. In this div there is
I have a container widget with a QVBoxLayout. I have about 100 widgets added
I have a container div with the following CSS: #container { position:relative; overflow:hidden; width:200px;
I have some problem with Android AsyncTask. There is an Activity which contains some
I have an image container with a caption and when I hover over it
I have a tab container with 5 tabs, each tab contains an update panel.
I have a DIV container with several inner DIVs layed out by floating them
I have an empty container with reserved memory. My function (algorithm) doesn't take a
Aim The aim is to a have a container DIV with a fixed height
Can EF really be this bad? Maybe... Let's say I have a fully loaded,

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.