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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:30:41+00:00 2026-06-03T11:30:41+00:00

I realize this question (or questions that look like this) have been asked over

  • 0

I realize this question (or questions that look like this) have been asked over and over and I feel like I’ve read all of them with no avail. I’m new to this so bear with me and it could be that through this frustration I’ve forgotten a fundamental nature of the list elements. Here’s my issue…

I have a thumbnail gallery with thumbs of different sizes (I’m dynamically loading thumbs from a folder upon page load). The thumbnail gallery is made using an ul. When I set the il’s property to inline so that they run back to back and not in a list the li’s don’t expand to fit the thumbs within. If I change the li display back to block (or remove display) they then expand to fit the contents… If I use display: inline-block the li content thumbs shrink to fit the li but then the li’s are still wider than the images…arg!

How do I tell the il to expand to fit the contents without specifying a size?

Here’s my CSS:

.gallery {
width: 100%;
cursor: default;

overflow:hidden;
}
.gallery ul {
list-style:none outside none;
overflow:hidden;
}
.gallery li {
background: #eee;
border-color: #ddd #bbb #aaa #ccc;
border-style: solid;
border-width: 1px;
color: inherit; 

margin: 3px;
padding: 5px;   

display:inline; 
position: relative;
vertical-align:top;

overflow:hidden;
}

here’s a sample of the code after it loads:

<div class="gallery">
 <ul>
  <li><a href="brown.png"><img src="/photos/brown.png" alt="" /></a></li>
  <li><a href="blue.png"><img src="/photos/blue.png" alt="" /></a></li>
  <li><a href="light-blue.png"><img src="./photos/light-blue.png" alt="" /></a></li>
 </ul>
</div>

So when I view the page I see something like the following:

         __             __
<   ----|  |----   ----|  |----
<   ----|__|----   ----|__|----

The center boxes represent the img elements and the smaller dashed rectangles in the background are the parent li elements. (sorry I couldn’t post a pic because I’m a newbie :))

Does anyone have any ideas?

Thanks in Advance!!

  • 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-03T11:30:49+00:00Added an answer on June 3, 2026 at 11:30 am

    David thanks!! – I just looked at the code you put on JS Fiddle and and couldn’t figure it out but when I changed display to inline-block it worked. Seriously I thought I tried inline-block at some point in the last million changes – oh well it works now 🙂 Thanks so Much for the reply!!!

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

Sidebar

Related Questions

I realize that this question has been asked 100times but none that I have
This question seems to have been asked before, but I feel like my situation
While I realize that this question has been asked once or twice ago but
I realize this question has probably been asked numerous times, but I have not
I asked this question in the restkit google group, but realize now that it
I realize this is a basic question but I have searched online, been to
I realize there have been a few other questions on this topic, and the
I realize that the answer to this question is likely quite obvious (if somewhat
I realize this question is pretty basic, but I'm really stuck. I have a
I know this question has been asked before, but none of the existing SO

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.