怎么设置bootstrap4 textarea初始高度40px
时间: 2024-02-16 10:03:34 浏览: 20
在Bootstrap 4中,你可以使用`form-control`类来设置textarea的样式,包括高度和宽度。你可以像下面这样设置textarea的初始高度为40px:
```
<textarea class="form-control" style="height: 40px;"></textarea>
```
你也可以在CSS中添加`.form-control`类来设置textarea的样式,代码如下:
```
.form-control {
height: 40px;
}
```
这样就可以让所有的`.form-control`元素的初始高度为40px了。如果你只想设置特定的textarea元素,可以为该元素单独添加一个类名,并在CSS中设置样式。
相关问题
怎么设置bootstrap table的tr高度代码
要设置 Bootstrap 表格中的 `<tr>` 元素的高度,可以使用 CSS 来控制。具体而言,您可以使用 `height` 属性来设置 `<tr>` 元素的高度。
以下是设置 Bootstrap 表格中 `<tr>` 元素的高度为 50 像素的示例代码:
```html
<table class="table">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr style="height: 50px;">
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr style="height: 50px;">
<td>2</td>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr style="height: 50px;">
<td>3</td>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
```
在每个 `<tr>` 元素中添加 `style` 属性,并设置 `height` 属性的值为所需的高度即可。请注意,这会将所有单元格的高度设置为相同的高度。如果您只想更改特定行的高度,则需要针对这些行单独进行设置。
bootStrap textarea
Bootstrap 提供了一个 textarea 样式,可以使 textarea 更加美观。使用 Bootstrap 样式,可以通过添加 Bootstrap 类名来实现。
例如:
```html
<div class="form-group">
<label for="exampleFormControlTextarea1">Example textarea</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
</div>
```
在上面的示例中,使用了 `form-group` 和 `form-control` 类来对 textarea 进行样式设置。你可以根据自己的需求调整行数和其他属性。