I've been seeing a trend lately of navigation bars shaped like this:
Wavey Navbar
I want to create such a navbar in my website, however, I can't seem to figure out how to do this.
I'm using reactjs, so I'm basically working with Html & CSS. Everything I try keeps giving me sharp edges like in the next picture:
My Navbar
I'm not even sure that I'm doing it right, but I can't seem to get it to be smooth and the shadow for some reason is not appearing in the half circle.
My code is as follows:
.navbar {
flex-wrap: nowrap;
width: 100vw;
height: 65px;
align-content: stretch;
justify-content: space-between;
position: fixed;
bottom: 0;
left: 0;
box-shadow: 0 -3px 5px 0 rgba(0,0,0,.09);
z-index: 999;
}
.navLink {
width: 20%;
height: 100%;
flex-direction: column;
font-size: xx-small;
justify-content: center;
font-weight: 700;
-webkit-transition: all 1s;
transition: all 1s;
background-color: #FFFFFF;
align-items: center;
}
.selectedLink {
padding-bottom: 25px;
height: 40px;
background-color: white;
background: radial-gradient(circle at top, transparent 34px, #FFF 20px);
display: flex;
flex-direction: row;
}
.icon {
width: 26px;
height: 26px;
}
.selectedLinkImage {
border-radius: 200px;
margin-bottom: 37px;
background-color: #564cac;
padding: 7px;
border: 6px solid transparent;
box-shadow: 0 -3px 5px 0 rgba(0,0,0,.50);
}
<nav class="navbar">
<div class="navLink selectedLink" id="feed-link">
<img class="icon selectedLinkImage" src="/static/media/home-active.9de5b1c3.svg" alt="feed button">
</div>
<div class="navLink" id="discover-link">
<img class="icon" src="/static/media/discover.a882adf8.svg" alt="discover button">
</div>
<div class="navLink" id="map-link">
<img class="icon" src="/static/media/map.9188e95b.png" alt="like button"> </div>
<div class="navLink" id="like-link">
<img class="icon" src="/static/media/heart.754f2ae1.svg" alt="like button"> </div>
<div class="navLink" id="purchase-link">
<img class="icon" src="/static/media/purchased.9bc694d4.svg" alt="purchased button">
</div>
</nav>
I think the easiest way is to do this with an image:
.header {
width: 600px;
height: 250px;
background: rgb(102, 100, 150);
background: linear-gradient(90deg, rgba(102, 100, 150, 1) 0%, rgba(9, 88, 121, 1) 32%, rgba(0, 212, 255, 1) 100%);
position: relative;
padding: 15px;
}
.container {
position: absolute;
width: 600px;
height: 150px;
top: 100px;
display: flex;
flex-direction: row;
}
.circle {
background-color: lightblue;
border-radius: 50%;
width: 130px;
height: 130px;
position: absolute;
left: 75px;
top: 40px;
}
.cutout {
width: 150px;
height: 150px;
background-image: url('data:image/png;base64,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');
}
.left {
width: 50px;
height: 150px;
background-color: white;
border-radius: 15px 0 0 15px;
}
.right {
width: 400px;
height: 150px;
background-color: white;
border-radius: 0 15px 15px 0;
}
<div class="header">
<div class="circle"></div>
<div class="container">
<div class="left"></div>
<div class="cutout"></div>
<div class="right"></div>
</div>
</div>
Related
I want to make the width of an image relative to it's parent div and still the highlighted box properly alinged on the words. But when I give image 100% width, it will not properly aligned.
Fiddle: https://jsfiddle.net/cv7g149k/3/
.summary {
background-color: #fff;
border: 2px solid #9197ae;
width: 700px;
padding: 15px;
margin: auto;
z-index: 1;
text-align: left;
box-shadow: 0 0 3px #000;
}
.image-results {
max-width: 700px;
margin: auto;
}
.image-holder {
display: block;
position: relative;
}
.word-highlight {
background-color: rgba(240, 45, 58, 0.3);
border: 1px solid rgba(240, 45, 58, 0.4);
position: absolute;
border-radius: 4px;
margin: -2px -4px;
padding: 2px 4px;
box-sizing: initial !important;
}
<div class="summary align-items-center">
<div class="px-2">
Number of Detected Words:<span>64</span>
</div>
<div class="px-2">
Detected words: <span>Python, Javascript</span>
</div>
</div>
<div class="image-results">
<div class="image-holder">
<img src="https://miro.medium.com/max/1400/0*GV5Xm8Ve-tb_qAAs" class="iimg-width-banned-words">
<div class="word-highlight" style="left: 171px; top: 173px; width: 70px; height: 22px;"></div>
<div class="word-highlight" style="left: 141px; top: 241px; width: 100px; height: 22px;"></div>
</div>
</div>
Instead of specifying exact px for the position of word-highlight classes, you may want to use % to define the position
.summary {
background-color: #fff;
border: 2px solid #9197ae;
width: 700px;
padding: 15px;
margin: auto;
z-index: 1;
text-align: left;
box-shadow: 0 0 3px #000;
}
.image-results {
max-width: 700px;
margin: auto;
}
.image-holder {
display: block;
position: relative;
}
.word-highlight {
background-color: rgba(240, 45, 58, 0.3);
border: 1px solid rgba(240, 45, 58, 0.4);
position: absolute;
border-radius: 4px;
margin: -2px -4px;
padding: 2px 4px;
box-sizing: initial !important;
}
img {
width: 100%;
}
<div class="summary align-items-center">
<div class="px-2">
Detected words:<span>64</span>
</div>
</div>
<div class="image-results">
<div class="image-holder">
<img src="https://miro.medium.com/max/1400/0*GV5Xm8Ve-tb_qAAs" class="iimg-width-banned-words">
<div class="word-highlight" style="left: 12%; top: 19%; width: 5.5%; height: 4%;"></div>
<div class="word-highlight" style="left: 10%; top: 26.5%; width: 8%; height: 4%;"></div>
</div>
</div>
Add width: 100%; and height: 100%: to your image class so that it fills 100% of the parent div. Then you will have to adjust your values for word-highlight.
.summary {
background-color: #fff;
border: 2px solid #9197ae;
width: 700px;
padding: 15px;
margin: auto;
z-index: 1;
text-align: left;
box-shadow: 0 0 3px #000;
}
.image-results {
max-width: 700px;
margin: auto;
}
.image-holder {
display: block;
position: relative;
}
.word-highlight {
background-color: rgba(240, 45, 58, 0.3);
border: 1px solid rgba(240, 45, 58, 0.4);
position: absolute;
border-radius: 4px;
margin: -2px -4px;
padding: 2px 4px;
box-sizing: initial !important;
}
.img-width-banned-words {
height: 100%;
width: 100%;
}
<div class="summary align-items-center">
<div class="px-2">
Number of Detected Words:<span>64</span>
</div>
<div class="px-2">
Detected words: <span>Python, Javascript</span>
</div>
</div>
<div class="image-results">
<div class="image-holder">
<img src="https://miro.medium.com/max/1400/0*GV5Xm8Ve-tb_qAAs" class="img-width-banned-words">
<div class="word-highlight" style="left: 80px;top: 83px;width: 44px;height: 20px;"></div>
<div class="word-highlight" style="left: 73px; top: 117px; width: 47.5px; height: 20px;"></div>
</div>
</div>
How do I totally color the bottom (only 25%) of a circle using CSS?
I want something like this:
Sample needed:
Result I have for now:
screenshot:
I want to remove the gap in the bottom and padding left and right
.story svg {
fill:none;
stroke:red(218, 218, 218);
stroke-width:4px;
stroke-dasharray:1;
stroke-dashoffset:0;
stroke-linecap: round;
stroke:#ff008c;
}
.semi-circle {
position: absolute;
bottom: 2%;
left: 50%;
transform: translate(-50%, -50%);
height: 30%;
width: 71%;
border-radius: 0 0 100% 100%;
background-image: linear-gradient(to bottom right, rgb(219, 219, 39), red);
}
<a class="" rel="">
<i style="border-radius: 16px"></i>
<svg class="" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="40">
</svg>
<div class="semi-circle"> <span class="sm-text"> Video </span> </div>
</a>
Here is an easy way on how you can do it
.circle {
width: 200px;
height: 200px;
border-radius: 50%;
background-color: #d8d8d8;
position: relative;
overflow: hidden;
}
.circle .box {
background-color: #9F3F40;
position: absolute;
bottom: 0;
left: 0;
right: 0;
color: #fff;
text-align: center;
height: 40%;
}
<div class="circle">
<div class="box">
<h2>video</h2>
</div>
</div>
I would use overflow: hidden on a parent div and flexbox to align the text with background to the bottom.
.circle {
height: 200px;
width: 200px;
border-radius: 50%;
overflow: hidden;
background: #d4d4d4;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.circle p {
color: white;
background: darkred;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 24px;
margin:0
}
<div class="circle">
<p>video</p>
</div>
I think I have solved it.
I tried doing it on my own and it kind of worked. Just try this and see if it works.
HTML:
<div class="circle">
<span class="text">text</span>
<div class="fill"></div>
</div>
CSS:
.circle {
display: inline-block;
width: 250px;
height: 250px;
border-radius: 50%;
border: 0px solid white;
text-align: center;
line-height: 250px;
overflow: hidden;
padding: 3px;
position: relative;
box-sizing: border-box;
box-shadow: 0 0 0 10px gray;
margin: 50px
}
.fill {
background-color: teal;
height: 50%;
width: 100%;
position: absolute;
bottom: -10px;
left: 0;
}
.text {
color: white;
position: absolute;
top: 60px;
left: 80px;
z-index: 1000;
font-size: 40px;
}
I think it's proper and you can change the color as you need. I will be giving the screenshot of the circle as well. Take a look at this:
I'm trying to draw this output with css (or svg). For me, the tough part is the half-arc at the left and right side of the circle. Should I stick to pure css or is it better using images?
Any help is appreciated...
This is what I managed to make :
Here is the code :
body {
background-color: #002911 !important;
}
h3 {
color: #ffd004;
}
#actions-container {
margin-top: 30px;
}
#actions-container .action-icon {
width: 200px;
height: 200px;
background-color: rgb(255, 208, 4);
border-radius: 50%;
box-shadow: 5px -2px 6px 3px #0000004a;
/* center contents*/
display: flex;
justify-content: center;
align-items: center;
}
.right-arc {
position: relative;
display: inline-block;
font-size: 30px;
color: lightgreen;
margin: 40px;
}
.right-arc::after {
content: '';
position: absolute;
right: -150px;
top: 57px;
height: 300px;
width: 300px;
border-radius: 50% 50% 50% 50%;
border-width: 0px 1px 0px 0px;
border-style: solid;
/*border-top: outset;*/
}
/*svg {
width: 33%;
height: auto;
}*/
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="container" id="actions-container">
<div class="d-flex justify-content-between">
<div class="action-icon-box text-center ">
<div class="right-arc">
</div>
<h3 class="text-center">Title</h3>
<div class="p-1 action-icon text-center mt-4">
<img class="center" src="/Content/images/lp-homepage/microphone.png" height="100" />
</div>
</div>
</div>
</div>
You could use a pseudo element with an inset box-shadow to create the fade out border on the bottom like this :
body {
background: #232323;
}
.wrap {
box-sizing: border-box;
position: relative;
width: 50%;
border: 3px solid #ffd004;
border-radius: 50%;
}
.wrap::before {
content:'';
display:block;
padding-bottom:100%;
}
.wrap::after {
content: '';
position: absolute;
bottom: -3px;
left: -3px;
right: -3px;
height: 100%;
z-index: 1;
box-shadow: inset 0px -270px 70px -100px #232323;
}
.title {
color: #ffd004;
margin: 0;
position: absolute;
top: -3px;
left: 0;
width: 100%;
text-align: center;
z-index: 2;
background: #232323;
}
.circle {
position: absolute;
top:15%;
left:15%;
width: 70%;
height: 70%;
border-radius: 50%;
background: #ffd004;
z-index: 2;
}
<div class="wrap">
<h2 class="title">Title</h2>
<div class="circle"></div>
</div>
Be aware that this will only work on plain color background. If you need to display this over a gradient or image, I highly suggest using SVG.
The aspect ratio of the circle is kept using the "padding technique" from this answer : Maintain the aspect ratio of a div with CSS
If you need transparency, you can use a mask-image with a linear-gradient.
/* based on #web-tiki's implementation */
body {
background: #232323;
}
.wrap {
box-sizing: border-box;
position: relative;
width: 50%;
padding: 60px;
}
/* the border */
.wrap::before {
content:"";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 3px solid #ffd004;
border-radius: 50%;
-webkit-mask-image: linear-gradient(transparent 10%, black 10%, transparent 80% );
mask-image: linear-gradient(transparent 10%, black 10%, transparent 80% );
}
/* the circle */
.wrap::after {
content:"";
display:block;
background: #ffd004;
padding-top: 100%;
border-radius: 50%;
box-shadow: 6px 0px 10px black;
}
.title {
color: #ffd004;
margin: 0;
position: absolute;
top: -3px;
left: 0;
right: 0;
text-align: center;
}
body:hover {
/* CSS checkerboard stolen from https://drafts.csswg.org/css-images-4/#example-2de97f53 */
background: repeating-conic-gradient(rgba(0,0,0,0.1) 0deg 25%, white 0deg 50%);
background-size: 2em 2em;
}
<div class="wrap">
<h2 class="title">Title</h2>
</div>
Try this
body {
background-color: #002911 !important;
}
h3 {
color: #ffd004;
}
#actions-container {
margin-top: 30px;
}
#actions-container .action-icon {
width: 200px;
height: 200px;
background-color: rgb(255, 208, 4);
border-radius: 50%;
box-shadow: 5px -2px 6px 3px #0000004a;
/* center contents*/
display: flex;
justify-content: center;
align-items: center;
}
.action-icon-box{
position: relative;
}
#actions-container .action-icon-box::after,#actions-container .action-icon-box::before{
position: absolute;
content: '';
width: 300px;
height:300px;
border-radius: 50%;
z-index:-1;
top:0px;
border: 2px solid;
border-color:transparent;
}
#actions-container .action-icon-box::before{
border-right-color: green;
right: -60px;
}
#actions-container .action-icon-box::after{
border-left-color: green;
left: -60px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container" id="actions-container">
<div class="d-flex justify-content-between">
<div class="action-icon-box text-center ">
<h3 class="text-center">Title</h3>
<div class="p-1 action-icon text-center mt-4">
<img class="center" src="/Content/images/lp-homepage/microphone.png" height="100" />
</div>
</div>
</div>
</div>
Here's my code. Can someone please help me understand why isn't my container div taking it's full height ?
I can only "fix" the problem by giving a fixed height, but I want it to take full height no matter how much content there is in it. It seems that something collapse, it won't expand and my footer keeps coming up.
Sorry if it is not clear and thank you for your answers.
/************* GLOBAL ***************/
* {
padding:0;
margin:0;
}
body{
margin: 0;
padding: 0;
background-color: #e6ccff;
font-size: 62.5%;
height: 100vh;
position:absolute;
}
.containerHead{
width: 80%;
height: 70px;
margin: 0 auto;
padding: 0 20px 0 20px;
/*border: 1px solid black;*/
}
.clr{
clear: both;
}
/************* HEADER *************/
header{
/*background-color: #528;
height: 70px;
box-shadow: 5px 5px 25px 7px #417 inset;*/
height: 70px;
background-color: rgba(0, 0, 0, 0.1)
}
.logo1 {
padding: 5px 10px 0 5px;
font-size: 20px;
float: left;
}
.logo1 img{
display: inline-block;
width: 100px;
height: 60px;
}
.logo2 {
padding: 5px 10px 0 5px;
font-size: 20px;
float: right;
}
.logo2 img{
display: inine-block;
width: 100px;
height: 60px;
transform: rotateY(180deg);
}
.navbar {
overflow: hidden;
width: 70%;
margin: 0;
position: absolute;
top: 28px;
margin-left: 250px;
width: 50%;
background-color: rgba(0, 0, 0, 0.1)
}
.navbar ul{
padding: 0;
margin: 0;
list-style-type: none;
float: left;
margin-left: 50px;
background-color: rgba(0, 0, 0, 0.1)
}
.navbar ul li {
float: left;
margin-left: 10px;
background-color: rgba(0, 0, 0, 0.1)
}
.navbar ul li a{
display: inline-block;
padding: 10px 15px;
text-decoration: none;
color: rgb(255, 255, 35);
text-align: center;
text-transform: uppercase;
font-size: 12px;
font-family: 'Raleway', sans-serif;
background-color: rgba(0, 0, 0, 0.1)
}
.nav-item1 :after{
content:"";
display: block;
height: 2px;
width: 0px;
background-color: transparent;
margin: 3px auto 0;
transition: .5s;
}
.nav-item1 :hover:after{
background-color: rgb(255, 255, 35);
width: 100%;
}
.nav-item2 :after{
content:"";
display: block;
height: 2px;
width: 0px;
background-color: transparent;
margin: 3px auto 0;
transition: .5s;
}
.nav-item2 :hover:after{
background-color: rgb(255, 255, 35);
width: 100%;
}
.nav-item3 :after{
content:"";
display: block;
height: 2px;
width: 0px;
background-color: transparent;
margin: 3px auto 0;
transition: .5s;
}
.nav-item3 :hover:after{
background-color: rgb(255, 255, 35);
width: 100%;
}
.nav-item4 :after{
content:"";
display: block;
height: 2px;
width: 0px;
background-color: transparent;
margin: 3px auto 0;
transition: .5s;
}
.nav-item4 :hover:after{
background-color: rgb(255, 255, 35);
width: 100%;
}
.nav-item5 :after{
content:"";
display: block;
height: 2px;
width: 0px;
background-color: transparent;
margin: 3px auto 0;
transition: .5s;
}
.nav-item5 :hover:after{
background-color: rgb(255, 255, 35);
width: 100%;
}
/*************** BANNER *****************/
.banner{
width: 100%;
height: 550px;
background-image: url('basket.jpeg');
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
border-bottom: 5px outset #528;
position: relative;
z-index: 1;
}
.cali {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 600px;
height: 400px;
background-image: url('cali.png');
background-size: cover;
z-index: 10;
transform: rotateZ(30deg);
}
/*************** CONTENT ****************/
.container{
width: 80%;
min-height: 100vh;
margin: 0 auto;
position: relative;
padding: 30px 30px 0;
/*border: 1px solid black;*/
clear:both;
background-color: #FFF;
height: 100vh;
overflow:hidden;
}
.title{
margin: 0 auto;
width: 380px;
text-align: center;
}
.box1 {
border: 1px solid black;
width: 80%;
margin: 0 auto;
position: relative;
top: 50px;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-items: center;
align-content: space-between;
}
/******************* FOOTER ***************/
footer{
background-color: #528;
height: 70px;
box-shadow: 5px 5px 25px 7px #417 inset;
}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>California Purple Eagles</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link rel="icon" type="image/png" sizes="32x32" href="eagle.png">
</head>
<body>
<header>
<div class="containerHead">
<span class="logo1"><img src="eagle.png" alt=""></span>
<nav class="navbar">
<ul>
<li class="nav-item1">Home</li>
<li class="nav-item2">Our Team</li>
<li class="nav-item3">Match Schedule</li>
<li class="nav-item4">Gallery</li>
<li class="nav-item5">Contact</li>
</ul>
</nav>
<span class="logo2"><img src="eagle.png" alt=""></span>
</div>
<div class="clr"></div>
</header>
<div class="banner">
<div class="cali">
<div class="clr"></div>
</div>
</div>
<div class="container">
<div class="title" id="titleteam">
<img src="ourTeam.png" alt="" class="team">
</div>
<div class="box1">
<img src="https://via.placeholder.com/100" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
<img src="https://via.placeholder.com/150" alt="">
</div>
</div><br><br><br><br><br><br><br>
<footer>
</footer>
</body>
</html>
could you try this? Adding display flex and making the padding to 0 normally helps me.
.container{
width: 80%;
margin: 0 auto;
position: relative;
padding: 0;
/*border: 1px solid black;*/
clear:both;
background-color: #FFF;
height: 100vh;
display:flex;
overflow:hidden;
}
I'm not quite sure what are you trying to achieve, but if you want your .container element to expand with its content, remove the positioning of the content. In your case, remove the position: relative; from .box1 and also remove height: 100vh; and min-height: 100vh; from .container so it can calculate its height itself.
I am trying to set three divs side by side with each equal width and height.
I am unable to remove that extra space at right at right most div. If I set its margin-right to 0 the rightmost div becomes bigger than other two.
Here is the fiddle.
Css:
.recordpopup {
position: fixed;
z-index: 10000;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: rgba( 0, 0, 0, .8);
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.recordpopup .retry {
background-color: black;
border: 1px solid white;
xborder-radius: 8px;
box-sizing: border-box;
color: white;
font-family: ProximaNova-Regular;
font-size: 16px;
font-weight: bold;
xheight: 50px;
margin-left: auto;
margin-right: auto;
padding-top: 0px;
position: relative;
text-align: center;
top: 30%;
width: 40%;
z-index: 15000;
border-radius: 8px;
padding: 20px 10px;
background-image: url('images/gray_bar.png');
background-repeat: repeat-x;
background-color: white;
}
#product-wrapper {
overflow: hidden;
margin-top: 25px;
}
.product {
float: left;
width: 33%;
display: table-cell;
width: 33.33333333%;
}
.product .container {
margin-right: 10px;
padding: 10px;
background-color: #000;
}
.product .container img {
display: block;
margin: 0 auto;
width: 100%;
}
#closeRecord {
background: black none repeat scroll 0 0;
border: 2px solid white;
border-radius: 50%;
color: white;
cursor: pointer;
height: 25px;
right: -15px;
left: right;
position: absolute;
top: -10px;
width: 25px;
}
Html:
<div class="recordpopup">
<div class="retry">
<div id="closeRecord">x</div>
<div style="width: 100%;text-align: left;margin: 5px 0;font-size: 12px;color:#333;"><span class="TitleText">Lorem Ipsum Lorem Ipsum</span> </div>
<div id="product-wrapper">
<div class="product">
<div class="container">
<img src="images/circle.png">
<p>Dummy</p>
</div>
</div>
<div class="product">
<div class="container">
<img src="images/circle.png">
<p>Dummy</p>
</div>
</div>
<div class="product">
<div class="container">
<img src="images/circle.png">
<p>Dummy</p>
</div>
</div>
</div>
</div>
</div>
Here is my solution.
The key is removing the margin-right: 10px and adding
.product:nth-child(1) .container{
margin-right:5px;
}
.product:nth-child(2) .container{
margin: 0 5px 0 5px;
}
.product:nth-child(3) .container{
margin-left: 5px;
}
JSFiddle ===> https://jsfiddle.net/kjkk3f9d/1/
The margin-right: 10px was pushing out your divs, replace it with margin: 0 5px to give a uniform look
.product .container {
margin: 0px 5px;
padding: 10px;
background-color: #000;
}
https://jsfiddle.net/kjkk3f9d/3/
check out my fiddle:
https://jsfiddle.net/kjkk3f9d/2/
the important styles are
#product-wrapper {
overflow: hidden;
margin-top: 25px;
display: flex;
justify-content: space-between;
}
.product {
flex-basis:0;
flex: 1 1 auto;
margin: 5px;
}