html展开显示样式,HTML步骤完成样式显示

50e88862f5c3?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

1.png

在项目中涉及到了步骤完成类型的样式显示,每个步骤中间要显示白色箭头,UI给我图的时候给我切了6张底图,在实现过程中觉得太麻烦,就用CSS写了,主要是用到伪类before和after,before完成模块前面的凹箭头,after完成模块后面的白色右箭头。具体如下:

.u_statedata:before {

content: '';

display: block;

position: absolute;

left: -3px;

z-index: 9;

top: 0px;

border-top: 13px solid #cacaca;

border-left: 13px solid transparent !important;

border-bottom: 13px solid #cacaca;

}

.u_statedata:after {

content: '';

display: block;

width: 16px;

height: 26px;

position: absolute;

right: -9px;

z-index: 9;

top: 0px;

border-top: 13px solid transparent !important;

border-left: 13px solid #cacaca;

border-bottom: 13px solid transparent !important;

background-color: #FFF;

}

为实现第一个模块的左边和最后一个模块的右边正常显示,则将第一个模块的伪类before和最后一个模块的伪类after设置为none:

.u_statedata:nth-of-type(1):before,

.u_statedata:nth-last-of-type(1):after{

display: none;

}

带颜色的模块部分为:

.u_statecomplete:before, .u_statecomplete:after {

border-color: #ffa200;

}

通过此方式设置即可完成如上图显示的样式。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值