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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:02:06+00:00 2026-05-24T10:02:06+00:00

I am fluent in CSS and JS. Using jQuery on this project. I have

  • 0

I am fluent in CSS and JS. Using jQuery on this project. I have a fluid grid which is comprised of an unordered list (with ‘li’ tags). Each ‘li’ (tile) has the same width and height. As the browser expands or contracts, the tiles wrap down or up to fill the space.

When a user clicks a tile I want the tile to expand to a larger fixed height and width, equivalent to TWO tiles width and FOUR tile heights. The surrounding tiles will of course have to shift to fit the inflated tile. But I need the tiles to continue to flow around this now larger tile, with no gaps.

I am wondering if the final composition of the tiles (with an inflated, floating tile) can be achieved with native CSS or if I need to write Javascript to help position the tiles around the inflated one.

  • 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-24T10:02:07+00:00Added an answer on May 24, 2026 at 10:02 am

    The best way I can think of would be adding a class to selected li and using CSS3 pseudo selectors to apply and clear floats based on position.

    e.g.

    li.active ~ li:nth-of-type(1n+2) {
        float: left
    }
    
    li.active ~ li:nth-of-type(1n+2):after {
        content: '\0a00' // whitespace
        width: 0;
        height: 0;
        line-height: 0;
        clear: left;
    }
    

    Incase you have not come across them I will explain the selectors.

    / the ~ ( tilde ) is an adjacent element selector, imagine the following html
    
    <li></li>
    <li></li>
    <li class="active"></li>
    <li></li>
    <li></li> 
    
    And css 
    
    li.active ~ li {
        background-color: green;
    }
    
    // the ~ would select all the li elements that come after the the occurence of 
    // .active element and apply a green background. illustrated below with an *
    
    <li></li>
    <li></li>
    <li class="active"></li>
    <li></li> *
    <li></li> *
    

    The nth-of-type selector allows you to select independent siblings of the matched element

    using previous html
    
    with this css
    
    // the nth-of-type value can also be an equation e.g. 1n + 2
    li:nth-of-type(2) {
        background-color: green;
    }
    
    <li></li>
    <li></li> *
    <li class="active"></li>
    <li></li>
    <li></li>
    

    Combined together

    li.active ~ li:nth-of-type(2) {
        background-color: green;
    }
    
    <li></li>
    <li></li> 
    <li class="active"></li>
    <li></li>
    <li></li> *
    

    This is a very elegant solution, it might take some fiddling to get the results you want, but you certainly have the tools in CSS to do it.

    Here is a full list of CSS3 selectors and what they do.

    http://www.w3.org/TR/css3-selectors/#selectors

    You may need to dig around to find better use examples than the ones provided in the the document, but at least you will know what to search for.

    It is obviously modern browsers only that support this, but you can fix IE support with

    ie9.js

    http://code.google.com/p/ie7-js/

    Or if that solution doesn’t grab your fancy

    I strongly recommend the previous suggestion of jQuery masonry

    http://masonry.desandro.com/

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

Sidebar

Related Questions

I'm using Fluent Mapping for a project with this ClassMap : public class PricingMap
I am learning Fluent NHibernate and this issue arose from that project. I have
This is a Fluent NHibernate newbie question, so bear with me. I have a
When using fluent configuration to specify fluent mappings like this: .Mappings(m => m.FluentMappings.AddFromAssembly(typeof(UserMapping).Assembly)) At
I have a fluent interface for an IoC container registration process, and this contains
i'm testing fluent-nhibernate in a small project. I have near 10 classes and when
I'm using Fluent NHibernate in order to auto map my entities. This is the
I am using Fluent NHibernate and NHibernate.Core 3 beta 1. I have two classes:
This is probably a basic CSS question, but I am not fluent in CSS
I have a Fluent NHibernate mapping override that I am using to create a

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.