Use display: flex
property and it make easy to align the content.
Along with it use align-items: center;
to vertically center align
.improvement_request_current {
display: block;
background: #777;
display:flex;
align-items:center;
}
.improvement_request_current_title {
background-color: #999;
color: blue;
}
.improvement_request_current_value {
display: inline-block;
}
<div class="improvement_request_current">
<span class="improvement_request_current_title">Just some text</span>
<textarea class="improvement_request_current_value" rows="6" cols="50" maxlength="4096"></textarea>
</div>
Also one other method can be providing fixed height
to parent and child(here given 100px
) and than vertical-align: middle;
.
But I don't recommend this method which you can see by removing comments from the background
property and see that it is spanning out of parent element
.improvement_request_current {
display: block;
background: #777;
}
.improvement_request_current_title {
/*background-color: #999;*/
color: blue;
display: inline-block;
vertical-align: middle;
}
.improvement_request_current_value {
display: inline-block;
vertical-align: middle
}
<div class="improvement_request_current">
<span class="improvement_request_current_title">Just some text</span>
<textarea class="improvement_request_current_value" rows="6" cols="50" maxlength="4096"></textarea>
</div>
Temani Afif has given a short and simple solution, using vertical-align: middle
to text-area
will solve your problem
.improvement_request_current {
display: block;
background: #777;
}
.improvement_request_current_title {
background-color: #999;
color: blue;
}
.improvement_request_current_value {
display: inline-block;
vertical-align: middle
}
<div class="improvement_request_current">
<span class="improvement_request_current_title">Just some text</span>
<textarea class="improvement_request_current_value" rows="6" cols="50" maxlength="4096"></textarea>
</div>