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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:06:25+00:00 2026-06-15T08:06:25+00:00

I have centered a div inside another div but want to left justify the

  • 0

I have centered a div inside another div but want to left justify the contents of the centered inner div. How can I do this?

My current HTML looks like this:

<div style="border: solid 1px #ff0000;text-align:center;">     
  <div style="border:solid 1px #00ff00;">
      <img src="/some_url_1/" style="width: 80px; height 80px; border: 0"/>
      <img src="/some_url_2/" style="width: 80px; height 80px; border: 0"/>
  </div>
</div>

Currently the images are centered inside the inner div but I would like them aligned to the left inside of the centered inner div.

Any idea what I’m missing?

  • 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-15T08:06:27+00:00Added an answer on June 15, 2026 at 8:06 am

    Use margins to center the inner element:

    <div id="outer">
        <div id="inner">
            Things to align to the left
        </div>
    </div>
    

    With the following CSS:

    #inner {
        width: 75%;
        margin: 0 auto;
        text-align: left; /* generally don't need to explicitly state this */
    }
    

    Demo: http://jsfiddle.net/W95Qy/

    Also, as a friendly suggestion, try as much as possible to keep CSS out of your HTML. It will generally make your code easier to read, manage, and preserve your long-term sanity in working in this field 😉

    • 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 another div centered inside with a background image.
I have four divs contained in another div, and I want the four inner
I have an inner div inside a containing div. HTML <div id="container"> <div id="inner"></div>
i have a HTML page with a centered div of 780px width and 8400px
how can I center my links like this? They all are centered inside a
I have this div and inside the div is an image, and what I
I have a small DIV with text-align:center . All it's contents must be centered.
I have a div inside another div. The outer div has a starting width
I have this set of html and css. What I want is to have
I have a div inside another div that has borders on the right and

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.