改变el-button的样式

4 篇文章 0 订阅
本文介绍了如何使用Element-UI库创建不同颜色的按钮,包括默认、主要、成功、信息、警告和危险等类型,并展示了如何通过设置type属性实现。此外,还详细讲解了如何自定义额外的颜色,以及为按钮添加鼠标悬浮和点击时的样式变化。对于禁用状态的按钮,也给出了相应的样式设置方法,确保在不同状态下保持视觉一致性。
摘要由CSDN通过智能技术生成

element-ui为我们提供了几种颜色的按钮,只需要设置 type属性就可以达到对应效果

在这里插入图片描述

<el-button>默认按钮</el-button>

<el-button type="primary">主要按钮</el-button>

<el-button type="success">成功按钮</el-button>

<el-button type="info">信息按钮</el-button>

<el-button type="warning">警告按钮</el-button>

<el-button type="danger">危险按钮</el-button>

如果我们想要更多颜色的按钮可以设置以下样式

<el-button class="set-other-btn">按钮</el-button>


.set-other-btn{
  color: #fff;
  background-color: #FA4EAB;
  border-color: #FA4EAB;
}
.set-other-btn:hover {鼠标悬浮
background-color: #FE83C6; border-color: #FE83C6; }

.set-other-btn:focus {鼠标点击
  background-color:  #FE83C6;
  border-color:  #FE83C6;
}

如果按钮使用了disabled属性,那么还要加入以下样式

.set-other-btn.is-disabled{
  background-color: #FE83C6;
  border-color: #FE83C6;
}
.set-other-btn.is-disabled:hover{
  background-color:  #FE83C6;
  border-color:  #FE83C6;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

游鱼_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值