[css] 举例说明:not()的使用场景有哪些
/* 子级之间留 10px 空隙 */
.gap-right-10 > :not(:last-child) {
margin-right: 10px;
}
/* 有数据时加上标题 */
.list-wrap:not(:empty):before {
content: attr(data-title);
}
/* flex 容器中都不压缩宽度 */
.flex-row {
display: flex;
align-items: center;
& > .grow { flex-grow: 1; }
& > :not(.grow) { flex-shrink: 0 }
}
个人简介
我是歌谣,欢迎和大家一起交流前后端知识。放弃很容易,
但坚持一定很酷。欢迎大家一起讨论
浙公网安备 33010602011771号