3 个回答

要实现这样带发光的倒三角,为何不直接用背景图片呢?

最好是让UI给你张图 要不会很麻烦

下边是大致实现的css

<div id='chevron'></div>
        #chevron {
            position: relative;
            text-align: center;
            margin-bottom: 6px;
            height: 100px;
            width: 200px;
            background: red;
        }

        #chevron:before {
            width: 0px;
            height: 0px;
            border-top: 50px solid red;
            border-left: 100px solid transparent;
            position: absolute;
            left: 0;
            top: 100%;
            content: '';
        }

        #chevron:after {
            width: 0px;
            height: 0px;
            border-top: 50px solid red;
            border-right: 100px solid transparent;
            position: absolute;
            right: 0;
            top: 100%;
            content: '';
        }

你这图上还有发光的图案,用代码来写也不是不行,只是时间上得不偿失,兼容性、性能方便也差,综合考虑还是还是老实的用图片吧。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题