<div class="card" data-attr="without :not()">
<div class="card-heading">
<div class="lines"></div>
</div>
<div class="card-body">
<ul>
<li>
<div class="avatar"></div>
<div class="lines"></div>
</li>
<li>
<div class="avatar"></div>
<div class="lines"></div>
</li>
</ul>
</div>
</div>
<div class="card" data-attr="with :not()">
<div class="card-heading">
<div class="lines"></div>
</div>
<div class="card-body">
<ul>
<li>
<div class="avatar"></div>
<div class="lines"></div>
</li>
<li>
<div class="avatar"></div>
<div class="lines"></div>
</li>
</ul>
</div>
</div>
body {
width: 100vw;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: flex-start;
padding: 2vw;
background: #eaeaea;
}
.card {
border-radius: 8px;
padding: 20px;
background: #eaeaea;
border: 1px solid #aeaeae;
margin: 10px;
position: relative;
&::before {
content: attr(data-attr);
position: absolute;
padding: 10px;
background: linear-gradient(to right, #f36, #f63);
color: #fff;
border-radius: 5px;
top: -25px;
}
}
ul {
list-style-type: none;
width: 500px;
margin: 0;
padding: 0;
}
li {
background: white;
border-radius: 8px;
overflow: hidden;
padding: 20px;
position: relative;
display: flex;
}
.avatar {
background: #eaeaea;
border-radius: 4px;
width: 80px;
height: 80px;
}
.lines {
height: 80px;
margin-left: 20px;
flex: 1;
}
.lines:before,
.lines:after {
background: #eaeaea;
content: ' ';
display: block;
margin-bottom: 10px;
width: 100%;
height: 10px;
}
.card-heading .lines{
height: auto;
margin-left: 0;
&:before,
&:after {
background: #fff;
margin-left: 0;
}
}
.card[data-attr ~= "without"] li{
margin-bottom: 20px;
}
.card[data-attr~="with"] li:not(:last-child){
margin-bottom: 20px;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.