There is a block in which text is closer to the end gradually disappears. This is done using the ::after
, which is given linear-gradient
from the transparent color to the background color.
Recently noticed that in current versions of browsers, all is well, everywhere except safari (and in the 11th, too bad). Autoprefix not solution (he's here and not needed).
My code:
* {
margin: 0;
padding: 0;
}
body {
display: flex;
min-height: 100vh;
}
p {
margin: auto;
width: 40vw;
height: 40vh;
max-width: 300px;
max-height: 300px;
overflow: hidden;
position: relative;
}
p::after {
content: '';
display: block;
position: absolute;
bottom: 0;
width: 100%;
height: 50%;
background-image: linear-gradient(transparent 0, white 100%);
}
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vel urna efficitur, tempor felis eu, lacinia sem. Nulla lacinia tincidunt turpis, faucibus luctus leo. Mauris lobortis orci lacus, vel luctus leo venenatis ac. Phasellus feugiat urna sit
amet nisi dapibus, a dignissim nibh dignissim. Suspendisse vel tempor nisl. Pellentesque hendrerit, nibh non vehicula finibus, turpis tellus auctor purus, ac placerat magna elit vel mauris. Nullam viverra venenatis enim. Vivamus odio lectus, maximus
quis dolor et, lobortis ullamcorper velit. Nulla fringilla ligula a metus faucibus commodo non ac lectus. Aenean bibendum arcu eu nibh convallis ornare.</p>
Decides to replace transparent
with rgba(255,255,255,0)
. But this is abnormal behavior, and a crutch in my opinion.
Any ideas?