I'm trying to achieve a display: flex
with position: fixed
that has the same width as its parent. However, my current code is extending beyond the boundaries of the parent container.
Here's what I've attempted so far. Please review the fiddle link below.
.container {
width: 400px;
padding: 5px;
background-color: red;
}
.flex {
display: flex;
position: fixed;
height: 100px;
width: 100%;
background: pink;
}
<div class="container">
<div class="flex">
<div class="items"></div>
<div class="items"></div>
<div class="items"></div>
</div>
</div>
I am looking for the .flex
container to match the width of its parent .container
when set to width: 100%
and position: fixed
.