element ‘Calendar ’日历样式修改

 默认样式

更改后样式 

代码如下

 <el-calendar v-model="calendar" class="calendar" :first-day-of-week="7"></el-calendar>

css页面相对定位 

 .calendar {
          width: 100%;
          font-size: 14px;
          position: relative;
  }

element-ui中公共样式

// 日历格式修改
.el-calendar {
  background-color: transparent;
  color: #fff;

}

.el-calendar-table .el-calendar-day {
  text-align: center;
  margin: auto 0;
  line-height: 10px;
  border: none;
  height: 22px;
  // padding-right: 5px;
  padding-bottom: 5px;
  text-align: center;
}

.el-calendar__header {
  border-bottom: none;
}

// 头部文字定位样式设设置
.el-calendar__header .el-calendar__title {
  position: absolute;
  left: 120px;
  top: 15px;
  transform: translate(-50%);
  font-size: 14px;
  color: #fff;
  z-index: 999;
  background-color: #010812;
  border: 1px solid #2f3135;
  border-radius: 5px;
  padding: 5px 10px 5px 10px;
}

// .el-calendar-table thead th:before{
//   content: '周';
// }

.el-calendar__button-group {
  width: 100%;
}

.el-button-group {
  display: flex;
  justify-content: space-between;
}

// 轴对齐
.el-button-group::after,
.el-button-group::before {
  content: unset;
}

// 今天按钮隐藏

.el-button-group>.el-button:not(:first-child):not(:last-child) {
  display: none;
}

// 按钮样式设置
.el-button-group>.el-button {
  background-color: transparent;
  border: none;
}

// 更改上月和下月样式
.el-button-group>.el-button:first-child:before {
  content: '<';
  border: none;
  font-size: 20px;
}

.el-button-group>.el-button:last-child:before {
  content: '>';
  border: none;
  font-size: 20px;
}

// 按钮隐藏
.el-button-group>.el-button:first-child span,
.el-button-group>.el-button:last-child span {
  display: none;
}

.el-calendar__body {
  padding-top: 0;
}

//  去除日期内边框

.el-calendar-table tr td {
  border: none;
}

// 去除左侧和上部边框
.el-calendar-table tr td:first-child {
  border-left: none;
}

.el-calendar-table tr:first-child td {
  border-top: none;
}

// 选择日期设置
.el-calendar-table td.is-selected {
  background-color: #16def0;
  color: #fff;
  border-radius: 70%;
}

.el-calendar-table .el-calendar-day:hover {
  background-color: #16def0;
  color: #fff;
  border-radius: 100px;
}

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值