first-child无效的问题

    1.一定要保证前面没有兄弟节点,要么就用div包住

    2.img:first-of-type{}也能达到first-child的效果,且前面可以有节点

    3.img:nth-of-type(1){}也能达到first-child的效果,且前面可以有节点

猜你喜欢

转载自blog.csdn.net/ljw_jiawei/article/details/83586488