I have been working on a project to create a chat window. Although most of it is coming together, I am having trouble getting the 'conversation' textarea to expand vertically and fill the remaining space in the window.
Below is the full code for my page (the textarea I need to adjust is inside the div id="conversation"
):
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<title>
chat prototype
</title>
</head>
<body>
<div id="completeSite" style="display: flex; flex-flow:row wrap" >
<div id="taskBar" class="col-md-12" style="border-style: solid; ">
TASKBAR
</div>
<div id="userList" class="col-md-2" style="border-style: solid;">
USERLIST
</div>
<div id="chatWindow" class="col-md-10" style="border-style:solid;">
<div id="conversation" class="row">
<textarea readonly class="form-control" style="overflow:auto; resize:none; border-style: solid;">CONVERSATION</textarea>
</div>
<div id="MessageInput" class="input-group row">
<textarea class="form-control" id="message" placeholder="Message" style="height: 200px; overflow:auto; resize:none;"></textarea>
<span class="input-group-btn">
<button class="btn" id="submitMessageButton" type="button" style="height: 200px; background-color: #999999">Send</button>
</span>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.js"></script>
</body>
</html>
All custom CSS styles are applied directly in the elements using style=
.
I have attempted some solutions:
Defined a relative
height:
, however this caused issues when the window was minimized as it adjusted based on screen size rather than window size.Tried using the flex approach by applying
on thedisplay:flex; flex-direction:column
div id=conversation
andflex: 1
on the textarea withindiv id=chatWindow
, but saw no results. Found this solution on Stack Overflow and gave it a shot.