html5计数器,HTML5 7段LED计数器

这篇博客探讨了如何使用CSS来创建一个数字显示器,通过设置html和body的基本样式,以及定义digit类和其内部segment类的样式,实现了数字的绝对定位和动画效果。文章详细介绍了每个segment的布局和状态切换时的透明度及阴影效果变化。
摘要由CSDN通过智能技术生成

CSS

语言:

CSSSCSS

确定

html,

body {

margin: 0;

padding: 0;

background: #000;

width: 100%;

height: 100%;

position: relative;

}

.digit {

position: absolute;

top: 50%;

left: 50%;

width: 200px;

height: 300px;

margin-top: -150px;

margin-left: -100px;

background: #000;

}

.digit .segment {

background: #c00;

border-radius: 5px;

position: absolute;

opacity: 0.3;

-webkit-transition: opacity 0.2s;

}

.digit .segment.on {

opacity: 1;

box-shadow: 0 0 100px #f00;

-webkit-transition: opacity 0s;

}

.digit .segment:nth-child(1) {

top: 10px;

left: 20px;

right: 20px;

height: 10px;

}

.digit .segment:nth-child(2) {

top: 20px;

right: 10px;

width: 10px;

height: calc(50% - 25px);

}

.digit .segment:nth-child(3) {

bottom: 20px;

right: 10px;

width: 10px;

height: calc(50% - 25px);

}

.digit .segment:nth-child(4) {

bottom: 10px;

right: 20px;

height: 10px;

left: 20px;

}

.digit .segment:nth-child(5) {

bottom: 20px;

left: 10px;

width: 10px;

height: calc(50% - 25px);

}

.digit .segment:nth-child(6) {

top: 20px;

left: 10px;

width: 10px;

height: calc(50% - 25px);

}

.digit .segment:nth-child(7) {

bottom: calc(50% - 5px);

right: 20px;

left: 20px;

height: 10px;

}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值