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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:22:32+00:00 2026-05-24T14:22:32+00:00

How can I set spacing between divs to auto inside fluid width parent div?

  • 0

How can I set spacing between divs to “auto” inside fluid width parent div? Is it even possible with CSS only?
More specific:
I have some parent div width width: 90%. I have 3 inline elements inside it. I want first element to touch left side of my parent div, second element to be in middle, and last element to touch right side of the parent div.

@edit:
I’m adding some code:

#news-pane {
    margin: 50px auto;
    width: 90%;
}

#news {
    color: #333;
    width: 300px;;
    vertical-align: top;
    display: inline-block;
}

#news img {
    max-width: 300px;
    height: auto;
}

HTML:

<ul id="news-pane">
    <li id="news">
        <div id="news-header">
           <h1>Title</h1><span>Date</span>
        </div>
        <p><News content</p>
    </li>
    <li id="news">
        <div id="news-header">
           <h1>Title</h1><span>Date</span>
        </div>
        <p><News content</p>
    </li>
    <li id="news">
        <div id="news-header">
           <h1>Title</h1><span>Date</span>
        </div>
        <p><News content</p>
    </li>
</ul>
  • 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-05-24T14:22:33+00:00Added an answer on May 24, 2026 at 2:22 pm

    You can make the first element float:left, the second element with auto margins and the third element float:right. AFAIK the elements have to be block for this to work.

    demo: http://jsfiddle.net/2CmSK/


    EDIT after seeing the code: The main problem is that you’re using the same id for multiple elements. You have to use unique ids or use classes instead. The HTML is invalid right now and might behave unpredictably in different browsers.

    The second problem is that the outer div’s width is given in percentages and the news items’ width is given in pixels. If the user’s browser window is less than 1000px wide the outer div will be less than 900px wide and the news items won’t fit inside.

    And between the lines I’m reading that you’re using some kind of closed/standard tool to generate the news items so you can’t modify the code and they all have to have the same structure. If this is the case then no, you can’t have them behave differently if they are structurally identical without using JavaScript.

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

Sidebar

Related Questions

How can I set line spacing with CSS, like we can set it in
Let's say by using jQuery I can set the width of a DIV doing
How can set the flag to set the condition of displaying a message only
I can set up an autofilter using pyWin32, but I wondered if it's possible
I think the line-spacing is different in both editors. How can I set the
Can anyone think of a reason why the spacing between the links in the
How can I set the letter spacing and vertical spacing for a UITextView? Trying
I can set the PHP include path in the php.ini : include_path = /path/to/site/includes/
I can set data in JTable constructor, and then user can change this data
I can set the minimum version required (for example XP SP3) in Inno-Setup by

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.