I have a question for CSS Gods
How do we expand the height of a DIV as new DIVs are added into it via JavaScript?
To see an example of what I am trying to do: we are creating a Node.js based Web chat where new chat messages are added to the chat DIV via Node/JS, as you can see in this sample room:
So as you add more and more messages then the chat_area DIV rather than auto expanding in Height starts writing over the input field and then goes off screen, etc. wrong. Even though this DIV has:
overflow: auto;
height: auto;
How do we then change the CSS for this DIV for it to Auto expand in Height as new messages are added to this DIV and it gets to the bottom of the chat area?
So if you keep typing in chat messages when you get to the bottom of the chat area, then additional messages rather than expanding the chat_area DIV they over flow onto the input field area (DIV: type_area)
Keep in mind that the type_area is position: fixed;
Well I wish that was the case But have checked it by myself and others from multiple different browsers and in each case the Text messages over flow the chat area and on top of the Text message input field.
The footer is fixed positioned at the bottom of the viewport so once any content approaches the bottom of the viewport the content in both elements will overlap. There’s nowhere else for them to go.
Therefore the choices you have are not to have a fixed positioned footer but one that stays at the bottom of the content (like a normal footer) and the content just grows as required.
If you must have a fixed positioned footer then you would need to place a vertical scrollbar on the chat area instead so that the content never reaches the footer as such.
Here’s a flexbox demo of that approach with individual scrollbars on the content.
The only other method would be perhaps to have a sticky footer and not a fixed positioned footer but I doubt that is what you wanted.
I think you need to take a step back and describe exactly what you expect to happen to each one of those elements in turn. At the moment the content will just grow and overlap the footer. (Your min-height of 600px on the middle panels is not usable either because that means the footer will overlap on screens with a smaller height than 650px.)
1st thanks for your as usual thoughtful reply.
So in answer to your question:
1- This is going to be a Chat page which is to be used on desktop/laptop and on Mobile phone browsers
2- The message input field is to be always visible as that is considered to be key to user friendly chat interface
3- The chat messages are then to scroll up and down as they reach the maximum they can fit into the chat area which is to be bounded by fixed top area and fixed bottom area, much as it is on the text messaging interface of your iPhone or Android and popular chat sites
So what CSS do we need to achieve these objectives?
These forums are about the extent of my chatting so I’m not up to speed on any of the interfaces.
I do feel like the one line text input would be a little too small for me. I like to be able to proofread my comments before clicking send/reply. Of course we have the option to go back and make edits here in the forum. A textarea with at least 3-4 lines of height would be a user friendly improvement.
As a user in your chat room I would appreciate the ability to toggle a larger chat panel if I was on a mobile device or a small screen. Screen real estate is very valuable on small devices so if I could toggle the panel it would make reading other comments much easier.
Working from the code Paul posted along with some slight changes I came up with something like this…
1st, very impressive Job man. You have produced more effect than staff I pay to do this stuff
However your code does not work in 1 Key extent which is as the messages posted reach the bottom of the screen they go off of view and get buried under the input field area, which requires one to continuously scroll up to see the latest message posted. You can see your sample page here:
Ray, This is a good suggestion. I am going to keep it in mind. But for now I would like to get the issue raised in this question addressed, which is how to create a Web Mobile friendly Chat interface that allows us to have Fixed top & Fixed bottom with the Chat area expanding and becoming scroleable as messages posted use the entire available chat area space.
But again your suggestion is going to go on top the “Consider” list for next and final features before this chat service goes live.
coothead,
1st. For various development and security reasons I had to take down chat_test.php which allowed Guest access to the Chat. I had put this up so you all could access the chat room at will. However the actual chat room, as being developed for real release, is at: http://www.sitesticky.com/chat.php
To access it though you need to either be an Anoox member which you can get for free here: https://www.anoox.com/news/sign_up.php
Or you can be invited by a member with your email address, so if you want to send me that I can invite you in without being member.
Ok, with that said thanks can you please send me the specific CSS/HTML code that you added which you think gets the desired outcome?
1st, you have done amazing work on this new Chat interface you have created. WOW! My hat off to you
I mean more quality work than people I pay to do such. But as nice as this revised chat room is it conflicts in many aspect with the actual chat interface which needs to be integrated into Anoox social network. So can you point me to the specific CSS / HTML & JS code that just handles the text messages scrolling within the Fixed Top and Fixed bottom?