霓虹灯绘画板效果 html+css+js

效果:

在这里插入图片描述

实现:

1. 定义标签,.main是底层盒子,.txt是文字,.dot是图中的小圆圈,用js动态大量添加。

 <div class="main">
        <h1 class="txt">北极光之夜</h1>
        <div class="dot" style="--color: red;"></div>      
    </div>

style="- -color: red;" 这个是var函数的应用,点击链接文章的开头讲有。
2. 底层盒子的基本样式:

.main{
   
   
          position: fixed;
          top: 0;
          left: 0;
          width: 100%; 
          height: 100%;
          background-color: rgb(0, 0, 0);
          display: flex;
          justify-content: space-around;
          flex-wrap: wrap;
          align-content: space-around;
          cursor: pointer;
        }

position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%; 相对于浏览器窗口进行定位,然后跟窗口一样大。
display: flex; flex布局;
justify-content: space-around; 主轴子元素平分剩余空间排列。
flex-wrap: wrap; 定义多行。
align-content: space-around; 侧轴子元素平分剩余空间排列。
cursor: pointer; 鼠标样式为小手。

3. 小圆圈的基本样式:

 .dot{
   
   
            position: relative;
            width: 20px;
            height: 20px;
           
        }

position: relative; 相对定位。

4. 用双伪类显示小圆圈:

 .dot::before{
   
   
            content: '';
            position: absolute;
            top: 1px;
            left: 1px;
            bottom: 1px;
            right: 1px;
            background-color: rgba(65, 64, 64,.5);       
            border-radius: 50%;
            transition: all 120s ease-out;            
        }

position: absolute; 绝对定位
background-color: rgba(65, 64, 64,.5); 颜色
border-radius: 50%;角弧度
transition: all 120s ease-out; 过渡效果。

5. 鼠标经过圆圈样式变化,颜色变,阴影变:

.dot:hover::before{
   
   
     
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

北极光之夜。

谢谢~

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

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

打赏作者

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

抵扣说明:

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

余额充值