当前位置:网站首页>Last child does not take effect
Last child does not take effect
2022-07-23 11:22:00 【A big river depends on waves】
Write css When I met a magical problem ,first-child take effect 、 but last-child invalid .
The observation style and code structure are as follows :
<div class="c0">
<div class="c1"></div>
<div class="c1"></div>
<div class="loading"></div>
</div>
.c0 .c1:last-child {
padding: 10px;
}
as a result of ,.c0 .c1:first-child , This selector finds c0 The next one is really c1, Match to the first line , take effect ..c0 .c1:last-child, The effective condition of this selector is c0 The last child element must be c1, But the actual HTML In structure , The last one is loading, So it didn't take effect .
The solution is 2 individual :
1、 Guarantee c0 Is a new nest div Last element of . But it's hard to do , The actual situation is always mixed with various types of elements .
2、 Use .c0 .c1:last-of-type
Reference documents :【CSS】 solve first-child、last-child No effect
边栏推荐
- Py program can run, but the packaged exe prompts an error: recursion is detected when loading the "CV2" binary extension. Please check the opencv installation.
- 【6.28】
- [部署]presto-server-0.261.tar.gz的集群部署和启动
- Oracle创建数据库“监听程序未启动或数据库服务未注册”错误处理
- 高阶函数的应用:手写Promise源码(三)
- uni-app小程序中v-show与display:flex一起使用时v-show不生效!
- Five methods to prevent over fitting of neural network
- Large factory interview machine learning algorithm (0): Feature Engineering | data preprocessing
- Transform: translate (-50%, -50%) border problem
- Fun code rain, share it online~-
猜你喜欢
随机推荐
Keras保存训练过程中的最好模型
页面实现 “实时数据响应” 的注意事项
Clear the buffer with getchar (strongly recommended, C language is error prone, typical)
第一篇博客
Paging and filtering
Celery异步发送短信
TypeScript 常用类型
The super simple face recognition API can realize face recognition in just a few lines of code
Use of views
【C语言】什么是函数?函数的分类和侧重(帮你快速分类和记忆函数)
解决手动查询Oracle数据库时间格式不正确的问题(DATE类型)
js的闭包的理解
高阶函数的应用:手写Promise源码(四)
JS, pay attention to passing parameters. If it is a string, you need to add escape characters
【无标题】
Framework introduction Mvt
Analysis of two-part search method or half search method of C language (classic example, classic analysis)
D2DEngine食用教程(1)———最简单的程序
TypeScript 高级类型
JS class array objects and methods of class array conversion (ES6, Es5)



![[Hudi]hudi的编译及hudi&spark和hudi&flink的简单使用](/img/6f/e6f5ef79c232d9b27a8334cd8ddaa5.png)
![[监控部署实操]基于granfana展示Prometheus的图表和loki+promtail的图表](/img/34/b7a05bff05e1d3a1daef4fb2b98a92.png)




![[pytho-flask笔记5]蓝图简单使用](/img/0a/00b259f42e2fa83d4871263cc5f184.png)