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

  • Home
  • SEARCH
  • 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 9014741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:35:00+00:00 2026-06-16T03:35:00+00:00

hello i would like to know if it is possible to center a div

  • 0

hello i would like to know if it is possible to center a div without having a width. because of two different versions of a container depending from language settings with different widths i would like to center it dynamically.

margin: 0 auto;

is not working without any settings of width.

so the structure is simple:

<div id="container">
        <div id="list">
            <span class="up">text large</span>
            <ul class="navigation">
                <li>one</li>
                <li>|</li>
                <li>two</li>
                <li>|</li>
                <li>three</li>
                <li>|</li>
                <li>four</li>
            </ul>
        </div>
</div>

and the css:

.wrapper #container  {
    width: 960px;
    clear: both;
    margin: 0 auto;
}

.wrapper #container #list {
    width: 420px;-->should be dynamically
    margin: 0 auto; --> only works when setting width
}
.wrapper #container #list .up {
    font-size: 11px;
    float: left;
    display: inline-block;
    text-align: right; 
    display: inline;
}
.wrapper .navigation {
    font-size: 10px;
    margin-top: 15px;
    float: left;
    padding-left: 5px;
}
.wrapper .nav li {
    float: left;
    display: inline-block;
    margin-left: 15px;
    list-style: none;
}

so if there is someone who knows how to deal with that i really would appreciate.

thanks alot.

UPDATE:

thanks for answering this question for so far. using:

display: inline-block;

on that container that should be centered works great.

  • 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-16T03:35:02+00:00Added an answer on June 16, 2026 at 3:35 am

    Use display: inline-block. See fiddle

    .wrapper #container  {
        /* ... */
        text-align: center;
    }
    .wrapper #container #list {
        display: inline-block;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello i would like to know how would it be possible to create a
Hello there i would like to know if it is possible to make a
Hello there I would like to know if it is possible to have voip
Hello I would like to know is is possible to drop all tables in
hello i would like to know if there is any dll or global hook
Hello I would like to know if my script is good; I want to
Hello everybody. I would like to know how to download and save a file
Hello i'd like to know if it's possible to store namespaces in an array?
I would like to know if it is possible to write in a text
Hello I would like to display an other splashscreen after the default one, if

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.