伪元素设置了分割线为什么不起作用

来源:5-5 CSS3背景 制作导航菜单综合练习题

虾滑咸鱼

2018-06-20 17:17

		.nav li:before{		   border:linear-gradient(to bottom,#ccc,#cc1,#ccc) left/1px 15px no-repeat;		}        /*删除第一项和最后一项导航分隔线*/		.nav li:first-child{		   display:none;		}		.nav li:last-child{		   display:none;		}

如代码所示

写回答 关注

2回答

  • 秋山在此
    2018-11-13 11:19:37

    .nav li::before和.nav li:first-child::before

    秋山在此

    或者 .nav li::after和.nav li:last-child::after

    2018-11-13 11:21:04

    共 1 条回复 >

  • qq_夜乡晟_0
    2018-06-21 18:07:39

    .nav li:after{

       content: '';

                position: absolute; width: 1px; height: 13px; top: 18px; right: 0;

                background-image: linear-gradient(to right, rgba(255,255,255,.5), grey);

                

            } 


十天精通CSS3

本课程为CSS3入门教程,深刻详解CSS3知识让网页穿上绚丽装备

242201 学习 · 2623 问题

查看课程

相似问题