Here is an example of HTML:
<ul id="navbar-main" class="navbar-nav mr-auto">
<li class="nav-item active">
<a href="https://travian.dev/materials" class="nav-link nav-materials">
<span class="invisible">Materials</span>
</a>
</li>
</ul>
Additionally, here is some SCSS:
#navbar-main {
li {
&.nav-item {
.nav-link {
width: 50px;
height: 50px;
background: no-repeat center;
background-size: contain;
&.nav-materials {
background-image: url('../images/buttons/menu-materials.png');
.active { // this is used to select .nav-item.active .navlink.nav-materials
background: red;
}
}
}
}
}
}
While the code is functioning, there is a desire for increased maintainability and readability. The aim is to achieve a structure like the following:
#navbar-main {
li {
&.nav-item {
.nav-link {
width: 50px;
height: 50px;
background: no-repeat center;
background-size: contain;
&.nav-materials {
background-image: url('../images/buttons/menu-materials.png');
.active { // here something to actually select .nav-item.active .navlink.nav-materials
background: red;
}
}
}
}
}
}