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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:09:38+00:00 2026-05-31T00:09:38+00:00

I have a setup similar to code below, where there can be any number

  • 0

I have a setup similar to code below, where there can be any number of items.

<div class="align-center" style="box-shadow: none; margin: 20px 0 0 20px; position: relative">
    ...
    ...
    ...
    ...
    ...
    <label class="photobox box-shadow clear-inner radius" style="display: inline-block; margin: 20px 20px 0 0" for="col_75291999308">
        <img class="radius-left cursor-pointer" height="128" width="128" alt="[thumb]" src="images/collection/thumb/penguins-madagascar-dr-blowhole.jpg" />
        <span class="large bold text-shadow black-text" style="line-height: 128px; padding: 0 5px">‣</span>
    </label>
    <input id="col_75291999308" class="switch single" type="radio" name="description" />
    <div class="box box-shadow" style="border: 5px solid #379; border-radius: 10px; left: 50%; margin: -74px 0 0 -266px; position: absolute; width: 512px; z-index: 999">Information</div>
    ...
    ...
</div>

If you’re curious, I’ll provide the CSS for the photo box. All the other classes are kind of self-explanatory (aside from box, which just applies a background and border radius).

input.switch { display: none }
input.switch.single + div { display: none }
input.switch.single:checked + div { display: block }

.photobox { background: #DDD; display: block; height: 128px; overflow: hidden }
.photobox:hover { background: #D5D5D5 }
.photobox > img { background: #CCC url('images/smooth/loading.png') repeat; border-right: 1px solid #BCC3C7; float: left; height: 128px; width: 128px }
.photobox > div, .position > span { cursor: pointer; height: 108px; margin-left: 129px; padding: 10px; position: relative }
.photobox > span { margin-left: 0 }
.photobox > div > .floater { color: #EEE; display: block; line-height: 14px; opacity: 0; position: absolute; top: 5px; left: -123px; text-shadow: -1px 0 #333, 0 1px #333, 1px 0 #333, 0 -1px #333 }
.photobox:hover > div > .floater { opacity: 1.0; transition: opacity .5s linear }

This is not the entire code, but basically each division corresponds to a label and input radio box. By default, the division is hidden and the label activates the radio box that corresponds to it, which then unhides the division immediately after it (the radio boxes are always hidden).

The idea is that the absolutely positioned element will center horizontally in the parent container and then stay at the same y position that it appears at normally (by not specifying top or bottom). However, the items in the very last row will cause this “popup” box to flow past the bottom of the parent container.

How can I prevent any and all of these boxes from extending past the bottom of the container? Basically, if there’s enough room, stay in the position it’s at. If there’s not enough room, it should push the box up to the bottom of the container. Is this possible with only CSS?

example

Keep in mind that this example just happens to use four columns, but the number of columns is completely dependent on the size of the client’s screen. Please don’t suggest server-side checks to “determine” if the item will be in the last row. Also, just to emphasize, no JavaScript.

  • 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-05-31T00:09:40+00:00Added an answer on May 31, 2026 at 12:09 am

    This does not appear to be possible with pure CSS. I tried everything I could thing of but the closest solution I could get was using :nth-last-of-type(-n+6) to push up the division for the last 6 items in the grid. The only problem with that solution was when a user resized the window (either smaller or larger), there weren’t always exactly 6 elements in the last row.

    I ended up retheming my site recently which now uses a definitive width, where there will always be 6 items in the last row, so the :nth-last-of-type(-n+6) selector works for me in this case.

    The only thing I could think of is if CSS ever implemented a :last-line selector similar to the existing :first-line selector, which would allow you to select the last line and then select each division inside that line… maybe? I don’t know if that’s even possible with that selector.

    Aside from using a fixed width for the parent, the idea from the comments is the next best way to go. As long as their is a sufficient amount of content below the parent (maybe a few extra lines), the expansion past the parents’ boundaries is not a huge deal and could just be left alone.

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

Sidebar

Related Questions

I have a list of divs similar to the simplified code below, which I've
I have code similar to the following: public class myButton extends JButton() { public
We're using Mercurial where I work and I want to have a setup similar
Short version: I have a similar setup to StackOverflow. Users get Achievements. I have
So I have a set up similar to this questions: Parent Child Setup Everything
I have a similar setup shown in this question and was wondering if I
I have set up an Oracle Package with a procedure similar to the code
I've got this setup in my code: public abstract class ModelBase{} public interface IModelbase<T>{}
Current I have some Views linked to ViewModels using code similar to the following:
I have a setup, something confusing like this: <ListView> <ItemTemplate> <div id=Content> <asp: TextBox

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.