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

The Archive Base Latest Questions

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

I’m trying to create some evenly spaced columns (an ol ), with the columns

  • 0

I’m trying to create some evenly spaced columns (an ol), with the columns themselves being fixed width.

So far, I’ve managed to achieve the desired effect by using table layout, and nesting an additional element inside the list item.

HTML:

<ol>
    <li><div></div></li>
    <li><div></div></li>
    <li><div></div></li>
    <li><div></div></li>
    <li><div></div></li>
</ol>​

CSS:

ol {
    display: table;
    width: 100%;
}

li {
    display: table-cell;
}

div {
    margin: 0 auto;
    width: 100px;
    height: 250px;
}

This works great, but has the following 2 shortcomings:

  1. As you can see in the demo, the first & last columns don’t line up flush with the parent’s outer edges.
  2. This can’t really be used responsively. The only thing you can do at smaller widths is stack them, but I’d like to split them (2 or 3 per row).

Is what I’m after even possible in CSS alone? I know there are a plethora of ways to accomplish this in JS, but I’m after a CSS-only solution.


P.S. I don’t care about IE7-, but I do need to support IE8. CSS3 selectors are OK though, since I’m anyhow using selectivizr in the project (I know that’s JS ;-)).

  • 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-12T08:10:17+00:00Added an answer on June 12, 2026 at 8:10 am

    It seems appropriate for you to recycle “how to *really* justify a horizontal menu”. Basically the behaviour you’re describing is that of inline-block elements of identical width having text-align:justify applied:

    ol {
      /*force the desired behaviour*/
      text-align: justify;
      /*remove the minimum gap between columns caused by whitespace*/
      font-size: 0;
    }
    
    li {
      /*make text-align property applicable*/
      display: inline;
    }
    
    /*force "justify" alignment that requires text to be at least over 2 lines*/
    ol:after {
      content: "";
      display: inline-block;
      position: relative;
      width: 100%;
      height: 0;
    }
    
    div {
      display: inline-block;
      width: 100px;
      height: 250px;
    }
    

    Working fiddle.

    NB: you may have to re-apply desired font-size and text-align to descendants of ol depending on the reset you’re using (i.e. to prevent these properties from being inherited)

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.