前端 鼠标经过盒子变阴影

11 篇文章 0 订阅
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>盒子阴影</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: darkseagreen;
            margin: 100px auto;
            /* 盒子阴影 */
            /* box-shadow: 10px 10px 10px rgba(0,0,0,0.3);  */
        }
        /* 鼠标经过盒子变阴影 */
        div:hover{
            box-shadow: 10px 10px 10px rgba(0,0,0,0.3); 
        }
    </style>
</head>
<body>
    <div>陈哈哈</div>
</body>
</html>

 

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要实现echarts折线图的阴影,可以通过设置series中的areaStyle属性来实现。具体的做法如下: 1. 在option中设置series的type为line,并设置data属性为对应的数据。 2. 在series中添加一个areaStyle属性,用来设置阴影的样式。 3. 在areaStyle中设置color属性为一个数组,数组中的每个元素都是一个对象,用来表示每个阶段的颜色和渐方式。例如: areaStyle: { color: [{ type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: 'rgba(255, 0, 0, 0.8)' // 0% 处的颜色 }, { offset: 1, color: 'rgba(255, 0, 0, 0)' // 100% 处的颜色 }], globalCoord: false // 缺省为 false }] } 4. 在color属性中,设置type为'linear'表示使用线性渐,x和y表示渐起点的坐标,x2和y2表示渐终点的坐标。 5. 在colorStops属性中,设置每个颜色的位置和颜色值。 6. 最后,在全局中设置tooltip的trigger为'axis',可以让折线图的每个点都显示tooltip。 下面是一个示例代码: ```javascript option = { tooltip: { trigger: 'axis' }, xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { type: 'value' }, series: [{ data: [820, 932, 901, 934, 1290, 1330, 1320], type: 'line', areaStyle: { color: [{ type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: 'rgba(255, 0, 0, 0.8)' // 0% 处的颜色 }, { offset: 1, color: 'rgba(255, 0, 0, 0)' // 100% 处的颜色 }], globalCoord: false // 缺省为 false }] } }] }; ``` 运行后,可以看到折线图的区域被设置为了红色的线性渐阴影

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值