<div class="selector">
<h2>[Attr|=value]</h2>
<ul>
<li data-years="1800-1900">The 19th Century</li>
<li data-years="1900-2000">The 20th Century</li>
<li data-years="2000-2100">The 21st Century</li>
</ul>
</div
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@200;300;400;500;600;700&family=Raleway:wght@200;300;400;500;600;700&display=swap");
* {
background: #000;
color: #fff;
font-size: 1.5rem;
font-family: "Raleway", sans-serif;
}
h3,
h2 {
font-size: 3rem;
background-image: linear-gradient(25deg, #002657, #662b54, #a9264f, #ec004a);
padding: 1em;
font-weight: 300;
}
h2 {
font-size: 2rem;
}
.selector {
text-align: center;
padding: 100px 0 0 0;
}
li {
list-style: none;
}
/* 7 types of selectors */
/* attr|=value */
li[data-years|="1900"] {
/* data-years attribute starts with 1900 as the only value or first in a dash-separated list */
color: red;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.