大玉麒麟
大玉麒麟
  • 发布:2019-05-31 11:02
  • 更新:2019-05-31 11:27
  • 阅读:1586

如果只有两个div,使用了first-child选了第一个,再用last-child选不到第二个

分类:HBuilderX

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
body {
background-color: #CCCCCC;
}
div {
color: #cccccc;
font: 900 80px "微软雅黑";
}
div:first-child {
/ text-shadow: 水平位置 垂直位置 模糊距离 阴影颜色; /
text-shadow: 1px 1px 1px #000000, -1px -1px 1px #ffffff;
}
/ 这里不知道为什么last-child选不中最后的div /
/* div:last-child {

            text-shadow: -1px -1px 1px #000000, 1px 1px 1px #ffffff;  
        } */  
        div:nth-child(2) {  
            text-shadow: -1px -1px 1px #000000, 1px 1px 1px #ffffff;  
        }  
    </style>  
</head>  
<body>  
    <div>  
        我是凸起的文字  
    </div>  
    <div>  
        我是凹下的文字  
    </div>  
</body>  

</html>

2019-05-31 11:02 负责人:无 分享
已邀请:
the_wolf_life

the_wolf_life - 大前端领航者

那么多选择器 可以试一下nth-of-type()

该问题目前已经被锁定, 无法添加新回复