<article style="--custom_color: pink">
<h2>This is a blog post</h2>
<p>Try hovering over this card!</p>
</article>
<article style="--custom_color: orange">
<h2>Here's another blog post</h2>
<p>It has an introduction!</p>
</article>
<article style="--custom_color: lightblue">
<h2>Blog post number three</h2>
<p>It has an introduction!</p>
</article>
<article style="--custom_color: lightgreen">
<h2>And another one</h2>
<p>It has an introduction!</p>
</article>
body {
padding: 1rem;
font-family: sans-serif;
}
article {
padding: 2rem;
margin-bottom: 1rem;
cursor: pointer;
background: lightgray;
transition: 100ms;
&:hover {
background: var(--custom_color);
}
}
h2 {
font-size: 1.8rem;
margin-bottom: 0.5rem;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.