Стиль для ::before заходит на текст, как это исправить?
.menu_item {
text-decoration: none;
display: block;
overflow: hidden;
color: #525252;
font-weight: 600;
font-family: 'Source Sans Pro', sans-serif;
cursor: pointer;
position: relative;
z-index: 2
}
.menu_item::before {
content: "";
display: block;
position: absolute;
width: 100%;
height: 100%;
background-color: #525252;
border: 0.1px solid #525252;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
left: -100%;
transition: 0.5s;
}
.menu_item:hover::before {
transition: 0.5s;
color: #b3b3b3;
left: 0%;
}
<a href="#" class="menu_item">home</a>
Ответы (2 шт):
Автор решения: CryNet
→ Ссылка
Нужно добавить свойство z-index псевдоэлементу
.menu_item::before {
z-index: -1;
}
Автор решения: Sevastopol'
→ Ссылка
.menu_item {
z-index: 1;
display: inline-block;
text-decoration: none;
overflow: hidden;
color: #525252;
font-weight: 600;
font-family: 'Source Sans Pro', sans-serif;
cursor: pointer;
position: relative;
z-index: 2
}
.menu_item::before {
z-index: -1;
content: "";
display: block;
position: absolute;
width: 100%;
height: 100%;
background-color: #525252;
border: 0.1px solid #525252;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
left: -100%;
transition: left 0.5s;
}
.menu_item:hover::before {
transition: 0.5s;
color: #b3b3b3;
left: 0%;
}
.menu_item:hover {
color: #fff;
}
<a href="#" class="menu_item">home</a>