I have this HTML code:
<div style="border: 2px red solid; background: blue;">
<textarea rows="6" style="width: 100%; height: 100%;"></textarea>
</div>
We can see the blue background of the parent container element around the edges of the textarea. Is there a way to full stretch the textarea to cover the entire parent it is in?
2
Answers
Two things:
height: 100%
, since therows
attribute of your<textarea>
element is setting the height (and the height of the parent<div>
).<textarea>
element is rendered withdisplay: inline-block;
by default, so settingdisplay: block;
should the trick.