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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:30:03+00:00 2026-06-06T00:30:03+00:00

I have an unordered list and each list element contains a photo and a

  • 0

I have an unordered list and each list element contains a photo and a headline. My CSS sets up the grid to be a grid, where each row contains three photos. Sometimes the headline (or photo caption) is longer than the width of the photo and has to span two lines. In some situations, when the text spans 2+ lines, the list element below it gets pushed to the right and there is a big gap in the list. The only fix that works for me is adding the following HTML <div style="clear:both"></div> after every three <li></li> elements. The issue can be seen in the third row of the list elements. I’ve tried researching this issue, but have not found a CSS only method. In my example code, I applied the CSS clearfix class, but it doesn’t seem to have any effect.

I’m using the latest version of Google Chrome.

Here is my code: http://jsfiddle.net/NVveP/1/

  • 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-06T00:30:04+00:00Added an answer on June 6, 2026 at 12:30 am

    Having both float: left and display: inline-block will in effect nullify display: inline-block, because float: left forces display: block.

    Hence, removing float: left allows display: inline-block to work, which combined with vertical-align: top is how you can achieve your desired layout.

    See: http://jsfiddle.net/thirtydot/NVveP/3/

    I also added a hack to make display: inline-block work in IE7, if that matters.

    It would be more difficult to do this with floats. You’d need something to the effect of:

    li:nth-child(3n+1) {
        clear: both;
    }
    

    Which has the problem of not working in older browsers such as IE7/8. Fortunately, there’s no need to worry about this because display: inline-block is the solution here, not floats.

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

Sidebar

Related Questions

I have an unordered list (each list element contains some further markup but this
I have three unordered list each surrounded by a container div (An example is
I have a unordered list, with each list element containing two spans (say span
I have to create unique, unordered sets of 2 elements each from a list
I have an unordered list with each list item background changing color when the
I have an unordered list, each list item has an id (id=6~OriginalName) - when
I have an unordered list with five list items, each with a link inside
I have an unordered list I'm using for a menu. Each item has a
I have a list of items in an unordered list. Each <LI> item has
I have an unordered list inside a div with a background image for each

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.