CCS设置第一个li的元素与其他li样式不同
1 <div class="ly-content-list"> 2 <ul> 3 <li> 4 <div class="title"> 5 <p>HBTMNO1234567890</p> 6 <span></span> 7 </div> 8 <div class="content"> 9 <p>账号:22</p> 10 <p>姓名:测试22</p> 11 <p>领用时间:2019-3-24 19:32:45</p> 12 <p>领用统计</p> 13 <p>GS3202:20000台</p> 14 <p>G-140W-MD:20000台</p> 15 <p>G-140W-MD:20000台</p> 16 17 <div class="scan-btn"> 18 <button class="detail-btn">查看设备详情</button> 19 <button >确认</button> 20 </div> 21 </div> 22 </li> 23 <li> 24 <div class="title"> 25 <p>HBTMNO1234567890</p> 26 <span></span> 27 </div> 28 <div class="content"> 29 <p>账号:ceshi</p> 30 <p>姓名:测试</p> 31 <p>领用时间:2019-3-24 19:32:45</p> 32 <p>领用统计</p> 33 <p>GS3202:20000台</p> 34 <p>G-140W-MD:20000台</p> 35 <p>G-140W-MD:20000台</p> 36 37 <div class="scan-btn"> 38 <button class="detail-btn">查看设备详情</button> 39 <button >确认</button> 40 </div> 41 </div> 42 </li> 43 44 </ul> 45 </div>
CSS代码:
1 .ly-content-list ul li:first-child .content { 2 position: relative; 3 color: #999999; 4 font-size: .2rem; 5 line-height: .4rem; 6 min-height: 1rem; 7 overflow: hidden; 8 padding: 0 .1rem; 9 display: ""; 10 } 11 .ly-content-list ul li:not(:first-child) .content { 12 position: relative; 13 color: #999999; 14 font-size: .2rem; 15 line-height: .4rem; 16 min-height: 1rem; 17 overflow: hidden; 18 padding: 0 .1rem; 19 display: none; 20 }
li:first-child:第一个li元素
li:not(:first-child):除了第一个li的其他元素