I am trying to set the height of a textarea
element based on the window size using css. The problem is, that if I set it using height
it will be good enough viewed on one monitor, but on another it will not be. Example:
textarea {
resize: none;
margin: 5px 10px 5px 10px;
border-radius: 8px;
height: 900px;
}
Can this be accomplished using just CSS or is it a job for JS?
EDIT:
My goal is to have 2 textarea
elements next to each other with small distance between them and a small distance from the bottom/top (ergo the margin). Both elements should hopefully have almost the height of the window size, which did not result after using height: 100%;
.
A link to a
jsfiddle, where height: 100%;
did not do the trick.
/* Commented out because of background img
body {
background-image: url(./images/background.jpg);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
*/
.btn-group button {
background: #DF6C6C;
border-color: transparent;
color: white;
padding: 10px 24px;
cursor: pointer;
float: left;
outline: 0px !important;
-webkit-appearance: none;
}
.btn-group button:not(:last-child) {
border-right: none;
/* Prevent double borders */
}
/* Clear floats (clearfix hack) */
.btn-group:after {
content: "";
clear: both;
display: table;
}
/* Add a background color on hover */
.btn-group button:hover {
background-color: #E58B8B;
}
/* Align buttons */
.wrapper {
text-align: center;
}
textarea {
resize: none;
margin: 5px 10px 5px 10px;
border-radius: 8px;
outline: 0px !important;
-webkit-appearance: none;
height: 100%;
}
<body>
<div class="wrapper">
<div class="btn-group">
<button>Button1</button>
<button>Button2</button>
<button>Button3</button>
<button>Button4</button>
<button>Button5</button>
<button>Button6</button>
</div>
</div>
<textarea></textarea>
</body>