移动Web 字体图标 2D平面转换 渐变效果

一.字体图标

首先通过阿里巴巴矢量图标库下载需要的字体图标样式(链接放在下方)

https://www.iconfont.cn/

字体图标的链接方式分为三种方式:直接链接、unicode、伪元素使用字体图标.

1.直接链接

<!-- 1.引入iconfont.css文件 -->
<link rel="stylesheet" href="./fonts/iconfont.css">
    <style>
        i {
            font-size: 50px !important;
            color: aqua;
        }
    </style>
</head>
<body>
    <!-- 2.使用类名 -->
    <i class="iconfont icon-gouwuchekong"></i>
</body>
</html>

2.unicode字体图标

<!-- 1.第一步引入字体图标的css -->
<link rel="stylesheet" href="./fonts/iconfont.css">
    <style>
       .green {
        color: green;
        font-size: 50px;
       }
    </style>
</head>
<body>
    <!-- 2.第二步添加固定类名iconfont,使用unicode编码 -->
    <i class="iconfont green">&#xe66a;</i>
</body>
</html>

3.伪元素使用字体图标

<link rel="stylesheet" href="./fonts/iconfont.css">

    <style>
        i::before {
            content: '\e66a';
        }
    </style>
</head>
<body>
    <i class="iconfont"></i>
</body>
</html>

二.2D平面转换

1.下面展示一个简单的2D的开门案例:

<!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>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
           width: 1366px;
           height: 600px;
           background: url(./images/bg.jpg) no-repeat;
           margin: 0 auto;
           overflow: hidden;
        }

        .left,
        .right {
            float: left;
            width: 50%;
            height: 600px;
            transition: all 1s;
        }


        .left {
           background: url(./images/fm.jpg) no-repeat;
        }

        .right {
            background: url(./images/fm.jpg) no-repeat right 0px;

        }

        .box:hover .left {
           transform: translateX(-100%);
        }

        .box:hover .right {
           transform: translateX(100%);
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="left"></div>
        <div class="right"></div>
    </div>
</body>
</html>

3.渐变效果

下面展示几个比较常用的背景色:

1.透明色到黑色半透明

2.透明色到白色半透明

<!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>Document</title>
    <style>
        .box {
            width: 500px;
            height: 500px;
            margin: 0 auto;
            /* linear-gradient线性渐变(颜色1,颜色2,颜色3) */
            /* background-image:linear-gradient(aqua, green, black); */
            
            /* to(到哪去...)属性,改变渐变颜色的方向 */
            background-image:linear-gradient(to left,aqua, green, black);

            /* 除了to属性 还可以使用角度deg */
            /* background-image:linear-gradient(-45deg, aqua, green, black); */


            /* 几个常用的背景色 */
            /* 透明色到黑色半透明 */
            /* background-image: linear-gradient(transparent,rgba(0,0,0,0.5)); */


            /* 透明色到白色半透明 */
            /* background-image: linear-gradient(transparent,rgba(255,255,255,0.5)); */
        }

        /* 注意点: */
        /* 1.渐变色使用背景的写background-image: */
        /* 2.渐变色是多个颜色组成 */
        /* 3.渐变色的颜色组成,角度后面有ui设计师提供 */
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

如果有需要改进的地方欢迎大家在评论区留言!!!

如果你觉得这篇文章对你有帮助的话希望能够点一个小小的赞,你的赞对我就是最大的鼓励与支持。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

程序员大臣

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值