My website features a <ul>
element with four nested <li>
elements, each belonging to the class .list
. In order to give them different colors, I assigned unique IDs to each one - <id="list1">
, <id="list2">
, <id="list3">
, and <id="list4">
.
.list{
float:right;
position:relative;
width: 120px;
height: 80px;
text-align: center;
line-height: 55px;
margin-top: -16px;
transition: all 0.4s ease-in-out;
}
.list h3{
font-family: 'Raleway', sans-serif;
color:rgb(51, 51, 51);
text-transform: uppercase;
font-weight: bold;
font-size: 13px;
z-index: 4;
height: 80px;
}
#list4:hover{
font-family: 'Raleway', sans-serif;
float:right;
position: relative;
width: 120px;
height: 80px;
text-align: center;
background-color: rgb(151, 215, 196);
transition: all 0.4s ease-in-out;
line-height: 55px;
margin-top: -16px;
}
#list3:hover{
font-family: 'Raleway', sans-serif;
float:right;
position: relative;
width: 120px;
height: 80px;
text-align: center;
background-color: rgb(215, 194, 151);
transition: all 0.4s ease-in-out;
line-height: 55px;
margin-top: -16px;
}
#list2:hover{
font-family: 'Raleway', sans-serif;
float:right;
position: relative;
width: 120px;
height: 80px;
text-align: center;
background-color: rgb(189, 215, 151);
transition: all 0.4s ease-in-out;
line-height: 55px;
margin-top: -16px;
}
#list1:hover{
font-family: 'Raleway', sans-serif;
float:right;
position: relative;
width: 120px;
height: 80px;
text-align: center;
background-color: rgb(151, 190, 215);
transition: all 0.4s ease-in-out;
line-height: 55px;
margin-top: -16px;
}
<ul>
<li class="list" id="list1">
<a href="#content1" class="smoothScroll">
<h3>contact</h3>
</a>
</li>
<li class="list" id="list2">
<a href="#content2" class="smoothScroll">
<h3>events</h3>
</a>
</li>
<li class="list" id="list3">
<a href="#content3" class="smoothScroll">
<h3>band</h3>
</a>
<li class="list" id="list4">
<a href="#main" class="smoothScroll">
<h3>home</h3>
</a>
</li>
</ul>
It seems that the current setup is not very efficient and I'm struggling to find an alternative method to achieve the same outcome. Any suggestions are welcome.