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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:10:01+00:00 2026-05-11T10:10:01+00:00

Is there an easy way to distribute inline elements within a parent block container

  • 0

Is there an easy way to distribute inline elements within a parent block container using CSS? Setting margins to auto doesn’t work since the margins between inline elements are set to 0 and I don’t want to mess around with percentages as the content is dynamic.

In particular, I have several anchor elements (a) within a paragraph (p) that spans 80% of its container and I’m looking for an easy way to distribute them evenly within the paragraph.

EDIT (@cletus): The paragraph will not wrap and the anchors are the only thing in the paragraph. By distribute evenly, I mean that the space between the left (right) edge and first (last) element and the elements themselves is equidistant.

  • 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. 2026-05-11T10:10:01+00:00Added an answer on May 11, 2026 at 10:10 am

    Hmmm, sounds to me like you’re creating a menu? You might want to use a list to hold your anchors and style the list accordingly. This is the commonly accepted best practice.

    As for even distribution of elements, I was looking yesterday for something similar, I was hoping it would be in the CSS3 spec, but it’s not (at least I can’t find it) which seems like a major f*ckup if you ask me. Anyway…

    Which leaves two options. CSS, and Javascript.

    With CSS, use the margin-right property for each element. It’s a good idea to create a .last class that sets margin-right to zero which prevents your last element from breaking the layout.

    There’s a bunch of javascripts out there that will do this for you. I prefer only to use JS when absolutely essential, so I couldn’t comment on which one is best.

    … there is one last thing you could try, but… you didn’t hear this from me ok?

    You could use a table. That is the quickest (and dirtiest) way to get what you want.

    IMHO, and you probably don’t want to hear this, but the design is probably flawed. It’s common knowledge that distributing items evenly across a layout with CSS is a pain, so designers should avoid it.

    UPDATE: You could also try

    .link_container { text-align: center; } .link_container a { margin-right: 10x; } .last { margin-right: 0; } 

    then use something like this

    <div class='link-container'>     <a href='...'>Some line</a>     <a href='...'>Some line</a>     <a href='...'>Some line</a>     <a class='last' href='...'>Some line</a> </div> 

    That might get you close.

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

Sidebar

Ask A Question

Stats

  • Questions 84k
  • Answers 84k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For usual crypto hashes (MD?, SHA? etc.), openssl is the… May 11, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer There is a standards based replacement,DOMContentLoaded that is supported by… May 11, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer Just because something meets the guideline doesn't mean it's guaranteed… May 11, 2026 at 5:02 pm

Related Questions

I am developing a scientific application used to perform physical simulations. The algorithms used
I am supposed to provide my users a really simple way of capturing video
As I understand it software being open source does not prevent you from selling
Do you know of an easy way to store and retrieve objects in Java

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.