<div class="app" data-attr="without something() selector">
<a href="">No has underline</a>
<nav>
<a href="">no has underline</a>
</nav>
</div>
<div class="app" data-attr="whit something() selector">
<a href="">Has underline with :something selector</a>
<nav>
<a href="">Has underline with :something selector</a>
</nav>
</div>
body {
width: 100vw;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: flex-start;
padding: 2vw;
background: #eaeaea;
}
a {
font-size: 1.3rem;
display: block;
margin: 10px;
}
.app {
border-radius: 8px;
padding:30px 20px 20px;
background: #fff;
border: 1px solid #aeaeae;
margin: 10px;
position: relative;
min-width: 80vh;
&::before {
content: attr(data-attr);
position: absolute;
padding: 10px;
background: linear-gradient(to right, #f36, #f63);
color: #fff;
border-radius: 5px;
top: -25px;
white-space: nowrap;
}
}
.app[data-attr~="without"] a:not(:hover) {
text-decoration: none;
color: red;
}
.app[data-attr~="without"] nav a{
// Has no effect
text-decoration: underline;
color: green;
}
.app[data-attr~="whit"] a:something(:not(:hover)) {
text-decoration: none;
color: red;
}
.app[data-attr~="whit"] nav a {
// Has effect
text-decoration: underline;
color: green;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.