I’ve a row of elements with some values in a container and its width is limited (eg 500px), but all of the elements takes more (eg 800px)
Using overflow-x: hidden
it looks like: DEMO
section {
display: flex;
}
#container {
max-width: 500px;
height: 30px;
overflow-x: hidden;
}
#container>* {
border: solid 1px black;
padding: 2px;
margin-right: 4px;
}
<section id="container">
<section>2.43</section>
<section>2.14</section>
<section>2.17</section>
<section>2.17</section>
<section>2.14</section>
<section>2.44</section>
<section>2.14</section>
<section>2.34</section>
<section>2.35</section>
<section>2.15</section>
<section>3.10</section>
<section>3.10</section>
<section>3.10</section>
<section>2.14</section>
<section>2.14</section>
<section>2.14</section>
<section>2.34</section>
<section>2.35</section>
<section>2.15</section>
<section>3.16</section>
<section>1.10</section>
<section>4.10</section>
</section>
But I want to see that (made in photoshop):
Is there a way to implement this smooth disappear without using box-shadow
, because I’m going to crate a dynamic background?
2
Answers
Use mask:
You can keep the overflow hidden and can add some extra styles to do what do you want.
To gain this, you need to add position relative to the section and then use these css,
This is the output I got
Expected output
For the whole thing, you can follow this Codepen link