<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
html, body {
height: 100%;
}
body {
display: grid;
grid-template-columns: repeat(4, 75px);
justify-content: center;
align-content: center;
}
.box{
display: grid;
justify-content: center;
align-content: center;
width: 50px;
height: 50px;
margin: 10px;
border: 3px solid #333;
color: #fff;
font-family: sans-serif;
font-weight: bold;
}
// Get All boxes but the second one
const boxes = document.querySelectorAll(':not(:nth-child(2))')
// Loop through boxes and apply a red border
// To elements with class "select"
for (const box of boxes) {
box.style.borderColor = "red"
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.