为了账号安全,请及时绑定邮箱和手机立即绑定

CSS3可以实现 三根线条 旋转成一个箭头吗,或者用其他办法?求大佬指导

CSS3可以实现 三根线条 旋转成一个箭头吗,或者用其他办法?求大佬指导

qq_控心_0 2017-01-31 21:54:04
就是三根相等的线条 变成 一个三角形箭头,能不能用CSS 或者JS 实现? 
查看完整描述

5 回答

已采纳
?
hahhhha

TA贡献50条经验 获得超32个赞

参考一楼代码,稍微加点动画渐变,代码如下。

<!DOCTYPE html>
<html>
<head>
    <style>
        .arrow {
            width: 65px;
            height: 50px;
            background: #000;
            padding: 30px 0 0 30px;
            margin:30px auto 0;
            position: relative;
        }
        .arrow i {
            display: block;
            width: 50px;
            height: 5px;
            background: #fff;
            position: absolute;
            border-radius: 10px 0 0 10px;
            transition:all 300ms;
        }
        .arrow i:nth-of-type(1) {
            width: 35px;
            top:20px;
        }
        .arrow i:nth-of-type(2) {
            width: 35px;
            top:35px;
        }
        .arrow i:nth-of-type(3) {
            width: 35px;
            top:50px;
        }
        .arrow:hover i{
            border-radius: 0;
            height: 3px;
        }
        .arrow:hover i:nth-of-type(1){
            top:35px;
            transform-origin: left center;
            transform: rotate(-45deg);
        }
        .arrow:hover i:nth-of-type(2){
            width: 55px;
            margin-left:-1px;
            border-radius: 10px 0 0 10px;
        }
        .arrow:hover i:nth-of-type(3){
            top:35px;
            transform-origin: left center;
            transform: rotate(45deg);
        }
    </style>
</head>
</body>
    <div class="arrow">
        <i></i>
        <i></i>
        <i></i>
    </div>
</body>
</html>


//img1.sycdn.imooc.com//589819b20001baa400350035.jpg

其实我真的不是东北人

查看完整回答
反对 回复 2017-02-06
?
其实我真的不是东北人

TA贡献105条经验 获得超66个赞

<!DOCTYPE html>

<html>

<head>

    <style>

        * {

            margin:0;

            padding:0;

        }

        .arrow {

            width: 80px;

            height: 50px;

            background: #000;

            padding: 30px 0 0 30px;

            margin:30px auto 0;

            position: relative;

        }

        .arrow i {

            display: block;

            width: 50px;

            height: 5px;

            background: #fff;

            position: absolute;

            border-radius: 10px 0 0 10px;


        }

        .arrow i:nth-of-type(1) {

            width: 35px;

            transform-origin: left center;

            transform: rotate(-35deg);

        }

        .arrow i:nth-of-type(3) {

            width: 35px;

            transform-origin: left center;

            transform: rotate(35deg);

        }

    </style>

</head>

</body>

<div class="arrow">

    <i></i>

    <i></i>

    <i></i>

</div>

</body>

</html>


查看完整回答
反对 回复 2017-02-01
  • qq_控心_0
    qq_控心_0
    很感谢你的回答,有些时间没上线看,不好意思。
?
安静的沙漠

TA贡献3条经验 获得超0个赞

楼上说的,就用CSS3 transform 

触发动画时中间的线条不变,上下两条各顺逆时针旋转45度,css动画有很多参数,根据案例调整一下就好了

查看完整回答
反对 回复 2017-02-01
?
慕粉昵称已占用

TA贡献1条经验 获得超0个赞

可以试试定位

查看完整回答
反对 回复 2017-02-01
  • qq_控心_0
    qq_控心_0
    我是想实现这个中间旋转的一个过渡动作,不是直接定位后的,还是谢谢你的回答
?
翰术

TA贡献21条经验 获得超8个赞

CSS3 transform 

可以平移 旋转 倾斜 缩放 


查看完整回答
反对 回复 2017-02-01
  • 5 回答
  • 0 关注
  • 4265 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信