I am making a website. In my HTML file, I have a div displayed as a flexbox. It's a horizontal div with 7 elements ('cards' with an image and a title). On hover, I want the element to increase width. When I do that it works but the other elements in the row decrease to fill the flex row correctly. I would rather like them to spread, to move away, even if the get out of the screen a bit. I want to make something a little bit like the movie cards in the Netflix website concerning the hover.
So here is a simplification of my site (the concerned part) :
body {
margin: 0;
font-family: sans-serif;
}
.row {
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.element {
width: 12%;
margin: 1.1428571vw;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
cursor: pointer;
transition: all .28s;
}
.element:hover {
width: 35%;
}
.element img {
width: 100%;
height: 17vw;
margin: 0;
}
.element h1 {
width: 100%;
height: 35px;
font-size: 16px;
font-weight: lighter;
margin: 14px 0;
}
<div class="row">
<div id="element1" class="element">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMzNkMWNmZGUtNWFlZi00MTYwLWIwMjQtOGViN2QzNmI2MWYwXkEyXkFqcGdeQXVyODA1MDc5NjM@._V1_.jpg" />
<h1>Element 1</h1>
</div>
<div id="element2" class="element">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMzNkMWNmZGUtNWFlZi00MTYwLWIwMjQtOGViN2QzNmI2MWYwXkEyXkFqcGdeQXVyODA1MDc5NjM@._V1_.jpg" />
<h1>Element 2</h1>
</div>
<div id="element3" class="element">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMzNkMWNmZGUtNWFlZi00MTYwLWIwMjQtOGViN2QzNmI2MWYwXkEyXkFqcGdeQXVyODA1MDc5NjM@._V1_.jpg" />
<h1>Element 3</h1>
</div>
<div id="element4" class="element">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMzNkMWNmZGUtNWFlZi00MTYwLWIwMjQtOGViN2QzNmI2MWYwXkEyXkFqcGdeQXVyODA1MDc5NjM@._V1_.jpg" />
<h1>Element 4</h1>
</div>
<div id="element5" class="element">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMzNkMWNmZGUtNWFlZi00MTYwLWIwMjQtOGViN2QzNmI2MWYwXkEyXkFqcGdeQXVyODA1MDc5NjM@._V1_.jpg" />
<h1>Element 5</h1>
</div>
<div id="element6" class="element">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMzNkMWNmZGUtNWFlZi00MTYwLWIwMjQtOGViN2QzNmI2MWYwXkEyXkFqcGdeQXVyODA1MDc5NjM@._V1_.jpg" />
<h1>Element 6</h1>
</div>
<div id="element7" class="element">
<img src="https://images-na.ssl-images-amazon.com/images/M/MV5BMzNkMWNmZGUtNWFlZi00MTYwLWIwMjQtOGViN2QzNmI2MWYwXkEyXkFqcGdeQXVyODA1MDc5NjM@._V1_.jpg" />
<h1>Element 7</h1>
</div>
</div>
So maybe I should use JavaScript to make want I want. I don't know I'm a bit lost here.
Here is my objective:
When you put the mouse on an element, I would like to increase a lot the width, a bit the height, blur the image and display some text over the blurred image (h1, h2 and p).
I really need a direction to achieve all this. So thanks a lot for the help.