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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:04:00+00:00 2026-05-23T02:04:00+00:00

I have a container with numerous but variable blocks in it. #container <- overflow

  • 0

I have a container with numerous but variable blocks in it.

#container <- overflow hidden
  .block
  .block

I need one of those blocks to have a height with overflow hidden. The idea is, the .chat div would have a height, with overflow hidden and then inside that there would be a .chatlog div with overflow auto.

#container <- overflow hidden
  .block
  .block
  .chat.block <- need a overflow hidden
    .chatlog <- need a overflow auto
      .chatmsg
      .chatmsg
      .chatmsg
    .chatentry

The most obvious thing to do is to add up all the other blocks in the container and substract that from the container height. But that’s sometimes unreliable if the other blocks load slowly or some such.

Is there something I can do with CSS that would keep the .chat.block in view and taking up all the remaining space not used by the other blocks.

Edit:

Here’s an example:
http://jsfiddle.net/Q923u/1/

The chat input is hidden because there are too many messages. I need to set the height of the .chat so that the input is shown.

  • 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-23T02:04:00+00:00Added an answer on May 23, 2026 at 2:04 am

    How’s this?

    http://www.spookandpuff.com/examples/chatView.html

    This uses a structure a little different to yours:

    #container
        .blockContainer
            .block
            .block
            .block
        .chat
            .chatlog
                .msg
                .msg
                .msg
            .chatentry
    

    This is so we can easily check the height of .blockContainer, and give the remaining height to .chat. This is done with a simple piece of jQuery-flavoured javascript:

    //Cache the important elements to avoid looking them up when we refresh:
            var container = $('#container'),
                blockContainer = container.find('.blockContainer'),
                chatContainer = container.find('.chat'),
                chatLog = chatContainer.find('.chatlog');
    
            container.bind('refresh', function(){
                //Determine the height of .blockContainer, and give .chat the leftovers
                chatContainer.css('top', function(){
                    return blockContainer.height(); //The 'top' property of the chat corresponds to the bottom of the block container
                });
    
            });
    

    This binds a custom event called ‘refresh’ to the #container element – whenever you need the heights to be re-calculated, you trigger this event like so: container.trigger('refresh') (or $('#container').trigger('refresh') if you don’t have the container cached like I have). You can trigger whenever a new chat or block item is added, when the window is resized, when an AJAX load finishes – it’s up to you.

    Feel free to take whatever you like from the example code – the styles there use ‘conflicting absolute positions’: more on the concept here: http://www.alistapart.com/articles/conflictingabsolutepositions/

    The CSS is not the most well-organised, but it should get you started. The demo page includes some controls for adding new blocks and messages, so you can see how the layout reacts to more or less content.

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

Sidebar

Related Questions

I have a container div with a fixed width and height , with overflow:
I have a container element which I need to resize as its contents change.
I have a container that contains an image that I need to drag from
I have used COALESCE numerous times but I suppose I never encountered this particular
I have an asp.net text form that contains numerous decimal fields that are optional.
I have a JSON result that contains numerous records. I'd like to show the
I have a container div that holds two internal divs; both should take 100%
I have a container filled with pairs. I want to iterate in it using
I have these container objects (let's call them Container) in a list. Each of
I have a container of custom controls each of which have 2 controls in

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.