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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:48:49+00:00 2026-06-05T23:48:49+00:00

This is my first attempt at responsive design, so I’m keeping it simple. I

  • 0

This is my first attempt at responsive design, so I’m keeping it simple.

I have a <ul> which is centrally aligned, with rows of 3 images. However, if the last row has only 1 or 2 images, the entire row is centrally aligned, and I wish to align the images to the left (so they are vertically aligned with the ones on top).

This would be easilly accomplished with float:left. However, I want the number of images on each row to adapt to the window size, while keeping the <ul> centered on screen.

Here’s a jsFiddle with only one item on the bottom row, which is centered. If you resize the window so it becomes smaller, the number or items on each row will adapt and the list will remain centered on screen, but the last row will still be centered. Is there any way I can align the last row to the left?

EDIT: Here’s some pictures, as requested. This is what I’m looking for:
the <ul> is centered on screen, but the bottom row is aligned to the left.

enter image description here

However, if we resize the window, the list will adapt, but the <ul> is still centered on screen, and the bottom row is still aligned to the left.

enter image description here

How can I accomplish this?

  • 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-05T23:48:50+00:00Added an answer on June 5, 2026 at 11:48 pm

    Normally I would suggest giving the ul a fixed width and margin: 0 auto; to center, however if you want it to expand with the page, then just give it some fixed left and right margins.

    http://jsfiddle.net/gQBpU/13/

    ul {
        max-width:800px;
        margin: 0 50px;
    }
    
    ul li {
        float: left;
    }
    
    ul li img {
        margin:5px;
    }
    

    ​

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

Sidebar

Related Questions

this is my first attempt at a responsive design so excuse me if this
This is my first attempt to write shorthand if statements however am befuddled by
I'm trying to create a simple threading procedure (granted this is my first attempt
this if my first attempt at using streaming for WCF, and I am struggling
This is my first attempt to create a GUI in MATLAB. I haven't been
Because this is my first attempt at an extension method that seems quite useful
Up front: This is my first attempt at an Android app. I'm in that
This is pretty strange (admitedly, this is my first attempt with python / sqlite),
Preface I've rarely ever been a JS developer and this is my first attempt
I have a custom UIView which is composed of many images, their positions are

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.