Можно ли как-то ограничить background linear-gradient у заголовка?
Такая ситуация: есть h1 и к нему добавлено свойство background со значением linear-gradient, а ещё у заголовка есть псевдоэлемент after, который также имеет это свойство.
В общем, хочу узнать: существует ли способ задать лимит для фона кнопки как это показано на скрине?
.main-menu-section h1 {
padding: 5px 10px 5px 10px;
color: white;
font-family: 'Montserrat', sans-serif;
font-size: 40px;
text-transform: uppercase;
text-align: center;
background: linear-gradient(to left, rgba(0, 45, 154, 1), #1f5fc7);
border-radius: 10px 5px;
font-weight: 700;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
}
.main-menu-section h1::after {
/* position: absolute; */
content: "БУКМЕКЕРОВ";
top: 100%;
}
<div class="main-menu-section">
<h1>ТОП-5</h1>
</div>
Ответы (1 шт):
Автор решения: BlackStar1991
→ Ссылка
.main-menu-section {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.main-menu-section h1 {
margin: 0 auto;
text-align: center;
display: inline-block;
padding: 5px 10px 0 10px;
color: white;
font-family: 'Montserrat', sans-serif;
font-size: 40px;
text-transform: uppercase;
background: linear-gradient(to left, rgba(0, 45, 154, 1), #1f5fc7);
border-top-right-radius: 10px;
border-top-left-radius: 10px;
font-weight: 700;
position: relative;
}
.main-menu-section h1::after {
position: absolute;
top: 100%;
content: "БУКМЕКЕРОВ";
background: inherit;
left: 50%;
transform: translateX(-50%);
border-radius: 10px;
padding: 5px 10px 5px 10px;
}
<div class="main-menu-section">
<h1>ТОП-5</h1>
</div>
PS Гемблинг - это зло, но клоакинг - это ещё большее зло.
