<el-col style=" font-size: 20px; font-weight: bold; text-align: center; " >如何设置字体
时间: 2024-02-10 13:35:03 浏览: 115
要设置字体,可以使用CSS样式来实现。在HTML标签的style属性中添加以下样式:
font-size: 20px; //设置字体大小为20像素
font-weight: bold; //加粗字体
text-align: center; //居中对齐文本
例如,如果要设置一个 div 元素的字体样式,可以这样写:
<div style="font-size: 20px; font-weight: bold; text-align: center;">这是我的文本</div>
相关问题
<el-col :span="5"> <el-card style="color:#409EFF"> <div style="color:#409EFF"><i class="el-icon-s-shop"/>能力发布驳回数</div> <div style="padding:10px 0;text-align:center;font-weight:bold">100</div> </el-card> </el-col> <el-col :span="5"> <el-card style="color:#409EFF"> <div style="color:#409EFF"><i class="el-icon-s-shop"/>人工告警数量</div> <div style="padding:10px 0;text-align:center;font-weight:bold">100</div> </el-card> </el-col> <el-col :span="5"> <el-card style="color:#409EFF"> <div style="color:#409EFF"><i class="el-icon-s-shop"/>自动告警数量</div> <div style="padding:10px 0;text-align:center;font-weight:bold">100</div> </el-card> </el-col> <el-col :span="5"> <el-card style="color:#409EFF"> <div style="color:#409EFF"><i class="el-icon-s-shop"/>钉钉告警数量</div> <div style="padding:10px 0;text-align:center;font-weight:bold">100</div> </el-card> </el-col> <el-col :span="5"> <el-card style="color:#409EFF"> <div style="color:#409EFF"><i class="el-icon-s-shop"/>BOMC告警数量</div> <div style="padding:10px 0;text-align:center;font-weight:bold">100</div> </el-card> </el-col> </el-row>如何让这五个卡片大小统一展示在一条线上
你可以尝试在每个 `<el-col>` 元素中添加 `align="center"` 属性,同时在最外层的 `<el-row>` 元素中添加 `justify="center"` 属性,代码如下:
```
<el-row justify="center">
<el-col :span="5" align="center">
<el-card style="color:#409EFF">
<div style="color:#409EFF"><i class="el-icon-s-shop"/>能力发布驳回数</div>
<div style="padding:10px 0;text-align:center;font-weight:bold">100</div>
</el-card>
</el-col>
<el-col :span="5" align="center">
<el-card style="color:#409EFF">
<div style="color:#409EFF"><i class="el-icon-s-shop"/>人工告警数量</div>
<div style="padding:10px 0;text-align:center;font-weight:bold">100</div>
</el-card>
</el-col>
<el-col :span="5" align="center">
<el-card style="color:#409EFF">
<div style="color:#409EFF"><i class="el-icon-s-shop"/>自动告警数量</div>
<div style="padding:10px 0;text-align:center;font-weight:bold">100</div>
</el-card>
</el-col>
<el-col :span="5" align="center">
<el-card style="color:#409EFF">
<div style="color:#409EFF"><i class="el-icon-s-shop"/>钉钉告警数量</div>
<div style="padding:10px 0;text-align:center;font-weight:bold">100</div>
</el-card>
</el-col>
<el-col :span="5" align="center">
<el-card style="color:#409EFF">
<div style="color:#409EFF"><i class="el-icon-s-shop"/>BOMC告警数量</div>
<div style="padding:10px 0;text-align:center;font-weight:bold">100</div>
</el-card>
</el-col>
</el-row>
```
这样设置后,每个卡片的宽度会被限定在 `<el-col>` 元素的宽度内,同时 `<el-row>` 元素的 `justify` 属性可以让所有的元素在水平方向上居中对齐。
<el-col :span="6"> <el-card style="color:#409EFF"> <div><i class="el-icon-user-solid"/>告警总数</div> <div style="padding:10px 0;text-align:center;font-weight:bold">1231</div> </el-card> </el-col> <el-col :span="6"> <el-card style="color:#F56C6C"> <div><i class="el-icon-money"/>销售总量</div> <div style="padding:10px 0;text-align:center;font-weight:bold">¥1000000</div> </el-card> </el-col>如何给这些块赋值
这些块看起来是用Element UI库的组件编写的。如果你想给这些块赋值,可以通过Vue.js的数据绑定来实现。
你可以在Vue.js的data对象中定义一个变量,例如:
```
data() {
return {
alarmCount: 1231,
salesAmount: 1000000
}
}
```
然后,在模板中使用这些变量来绑定数据,例如:
```
<el-col :span="6">
<el-card style="color:#409EFF">
<div><i class="el-icon-user-solid"/>告警总数</div>
<div style="padding:10px 0;text-align:center;font-weight:bold">{{ alarmCount }}</div>
</el-card>
</el-col>
<el-col :span="6">
<el-card style="color:#F56C6C">
<div><i class="el-icon-money"/>销售总量</div>
<div style="padding:10px 0;text-align:center;font-weight:bold">{{ salesAmount | currency }}</div>
</el-card>
</el-col>
```
在这个例子中,我们将Vue.js的数据绑定语法`{{ }}`用于告警总数和销售总量的值。我们还使用了Vue.js的过滤器来格式化销售总量的值为货币格式。
阅读全文