使用css进行控制,如下:
<style>
/* Textarea styling */
textarea {
top: 0px !important;
left: 0px !important;
width: 100%;
height: 100%;
position: absolute;
resize: none;
-webkit-box-sizing: border-box; /* <=iOS4, <= Android 2.3 */
-moz-box-sizing: border-box; /* FF1+ */
box-sizing: border-box; /* Chrome, IE8, Opera, Safari 5.1*/
border: solid;
border-width: 4px;
border-color: white;
background-color: #D7EFEF;
margin:0px;
padding:0px;
}
/* Basic table styling */
table {
border-collapse: collapse;
}
table, th, td {
position: relative;
border: 1px solid black;
}
</style>
完整的html如下:
<html>
<head>
<style>
/* Textarea styling */
textarea {
top: 0px !important;
left: 0px !important;
width: 100%;
height: 100%;
position: absolute;
resize: none;
-webkit-box-sizing: border-box; /* <=iOS4, <= Android 2.3 */
-moz-box-sizing: border-box; /* FF1+ */
box-sizing: border-box; /* Chrome, IE8, Opera, Safari 5.1*/
border: solid;
border-width: 4px;
border-color: white;
background-color: #D7EFEF;
margin:0px;
padding:0px;
}
/* Basic table styling */
table {
border-collapse: collapse;
}
table, th, td {
position: relative;
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<td>Text</td>
<td>Text</td>
<td>Text</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td rowspan="5">
<textarea></textarea>
</td>
<td>Text</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>Text</td>
</tr>
</table>
</body>
</html>