Как выполнить hover для двух элементов сразу?
.box {
border: 2px solid white;
}
.main-catalog {
text-align: center;
}
.main-catalog-black {
text-align: center;
}
.main-catalog a {
position:relative;
color: white ;
cursor: pointer;
line-height: 1;
text-decoration: none;
font-weight:bold;
}
.main-catalog-black a {
position:relative;
color: #000 ;
cursor: pointer;
line-height: 1;
text-decoration: none;
font-weight:bold;
}
.main-catalog a:after {
display: block;
position: absolute;
left: 0;
width: 0;
height: 2px;
background-color: white;
content: "";
transition: width 0.3s ease-out;
}
.main-catalog-black a:after {
display: block;
position: absolute;
left: 0;
width: 0;
height: 2px;
background-color: #000;
content: "";
transition: width 0.3s ease-out;
}
.main-catalog a:hover:after,
.main-catalog a:focus:after {
width: 100%;
}
.main-catalog-black a:hover:after,
.main-catalog-black a:focus:after {
width: 100%;
}
<div class="main-catalog">
<a href="/milk/">МОЛОЧНАЯ ПРОМЫШЛЕННОСТЬ</a>
</div>