We would like to know how to expand textarea to width of container.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.container {<!-- www . j av a2s . c o m-->
width: 300px;
border: black solid 1px;
margin: 10px;
}
.container>div {
display: block;
padding: 10px;
background: red;
}
.container>textarea {
display: block;
padding: 10px;
background: red;
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
</style>
</head>
<body>
<div class='container'>
<div>test</div>
</div>
<div class='container'>
<textarea>test</textarea>
</div>
</body>
</html>
The code above is rendered as follows: