Flexbox product grid not works - css

I have a product grid with Bootstrap and I added flexbox styles for the products .item box have same height.
You can check the grid here:
https://jsfiddle.net/oet3c3dp/2/
I add the basic flexbox styles, for the parent element .product-list:
.product-list {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
-webkit-justify-content: space-between;
justify-content: space-between;
}
And then I added the styles for the child's elements:
.product-list .item {
padding: 0 10px 10px 0px;
margin-left: 0;
float: left;
text-align: center;
-webkit-flex: 0 0 auto;
flex: 0 0 auto;
}
Why this not works fine?

You are missing classes .container and .row (which they are part of the bootstrap grid), plus you need to change your flex: 0 0 auto to flex:1
.product-list {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
-webkit-justify-content: space-between;
justify-content: space-between;
}
.product-list .item {
padding: 0 10px 10px 0px;
margin-left: 0;
float: left;
text-align: center;
-webkit-flex: 1;
flex: 1;
}
.product-list .color-swatch {
width: 16px;
height: 16px;
border: 1px solid;
border-color: #d8d9db;
display: inline-block;
vertical-align: middle;
-webkit-border-top-right-radius: 50%;
border-top-right-radius: 50%;
-webkit-border-bottom-right-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
border-bottom-left-radius: 0;
-webkit-border-top-left-radius: 0;
border-top-left-radius: 0;
-webkit-border-radius: 50%;
border-radius: 50%;
background-clip: padding-box;
-webkit-box-shadow: 0 3px 8px -5px black inset, -3px -1px 8px -4px white inset;
box-shadow: 0 3px 8px -5px black inset, -3px -1px 8px -4px white inset;
}
.product-list h3 {
font-size: 14px;
margin: 0px;
text-transform: uppercase;
margin-top: 2px;
}
.item-inner {
position: relative;
padding: 0 18px;
border: 1px solid #e0e0e0;
background-color: #fff;
/*min-height: 300px*/
}
.product-img {
padding-top: 10px;
text-align: center;
/* min-width: 210px;
height: 220px;*/
overflow: hidden;
/*width: 170px;*/
}
.product-info {
position: relative;
/*height: 73px;*/
padding-top: 20px;
}
.product-info span.extra-info {
display: block;
color: #455A64;
font-size: 12px;
}
.product-img img {
display: inline-block;
vertical-align: middle;
/* max-width: 210px;
max-height: 210px;*/
}
.product-list .item .price {
color: #37474F;
font-weight: 700;
font-size: 18px;
margin-right: 10px;
}
.product-list .item .product-id {
color: #455A64;
}
.product-list .item-inner:hover {
box-shadow: 0 3px 6px 0 rgba(51, 51, 51, .2);
}
.product-list .item a:hover {
color: #651fff;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="product-list row">
<div class="item col-xs-6 col-sm-3">
<div class="item-inner">
<a href="">
<div class="product-img">
<img class="img-responsive" src="http://rp-static.com/common/images/products_new/1728/1_m.jpg?dts={DPL_TS}" alt="">
</div>
<div class="product-info">
<div class="block">
<span class="price">9,95 €</span>
<span class="product-id">#1728</span>
</div>
<h3>TAZA CERAMICA</h3>
</div>
</a>
</div>
</div>
<div class="item col-xs-6 col-sm-3">
<div class="item-inner">
<a href="">
<div class="product-img">
<img class="img-responsive" src="http://rp-static.com/common/images/products_new/2100/1_m.jpg?dts={DPL_TS}" alt="">
</div>
<div class="product-info">
<div class="block">
<span class="price">16 €</span>
<span class="product-id">#2100</span>
</div>
<h3>MATRICULA MINI</h3>
</div>
</a>
</div>
</div>
<div class="item col-xs-6 col-sm-3">
<div class="item-inner">
<a href="">
<div class="product-img">
<img class="img-responsive" src="http://rp-static.com/common/images/products_new/2638/1_m.jpg?dts={DPL_TS}" alt="">
</div>
<div class="product-info">
<div class="block">
<span class="price">29 €</span>
<span class="product-id">#2638</span>
</div>
<h3>RELOJ PULSERA ZAC</h3>
</div>
</a>
</div>
</div>
<div class="item col-xs-6 col-sm-3">
<div class="item-inner">
<a href="">
<div class="product-img">
<img class="img-responsive" src="http://rp-static.com/common/images/products_new/5407/1_m.jpg?dts={DPL_TS}" alt="">
</div>
<div class="product-info">
<div class="block">
<span class="price">39 €</span>
<span class="product-id">#5407</span>
</div>
<h3>BOLSO VAQUERO PEQUEÑO</h3>
</div>
</a>
</div>
</div>
</div>
</div>

Related

Can't seem to get containers aligned properly even though I am using flexbox

import "./portfolio.scss"
export default function portfolio() {
return (
<div className="portfolio" id="portfolio">
<h1>Portfolio</h1>
<ul>
<li className="active">Featured</li>
<li>Web app</li>
<li>Mobile app</li>
<li>Design</li>
<li>Branding</li>
</ul>
<div className="container">
<div className="item">
<img
src="assets/default-product-image.png"
alt="" />
<h3>Coming soon</h3>
</div>
<div className="container">
<div className="item">
<img
src="assets/default-product-image.png"
alt=""/>
<h3>Coming soon</h3>
</div>
<div className="container">
<div className="item">
<img
src="assets/default-product-image.png"
alt=""/>
<h3>Coming soon</h3>
</div>
</div>
</div>
</div>
</div>
)
}
This is my .jsx I am making div's with containers in them and the containers seem to not be aligned properly, see the picture below.
I am trying to get them all aligned with even margin but the third one seems to be off, when i change the device on which i view it tho they align perfectly below each other.
and this is my scss
#import "../../global.scss";
.portfolio{
background-color: lightblue;
display: flex;
flex-direction: column;
align-items: center;
h1{
font-style: 500px;
}
ul{
margin: 10px;
padding: 0;
list-style: none;
display: flex;
li{
font-size: 14px;
margin-right: 9px;
padding: 7px;
border-radius: 10px;
cursor: pointer;
&.active{
background-color: $mainColor;
color: white;
}
}
}
.container{
width: 70%;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
.item{
width: 220px;
height: 150px;
border-radius: 20px;
border: 1px solid rgb(240, 234, 234);
margin: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
color: white;
position: relative;
h3{
position: absolute;
font-style: 20px;
}
img{
width: 100%;
height: 100%;
object-fit: cover;
z-index: 1;
}
&:hover{
background-color: $mainColor;
img{
opacity: 0;
z-index: 0;
}
}
}
}
}
This is what it looks like right now I want the items to be evenly spread apart.
The way you have the <div class='container'>s nested is probably what is causing misalignment. I don't see any images in your question, but I'm willing to bet your code is producing containers that get smaller and smaller the further down the tree it gets, which is exaggerated on small screens.
Start by closing your container divs before opening another. Also, use consistent indentation - that will help make this issue more obvious when you're reading your code. I have cleaned up your code and changed nothing except the HTML markup. The top example in the linked pen has cleaned up markup, while the bottom example has the containers grouped.
https://codepen.io/the_Northway/pen/QWqapbg?editors=1100
.portfolio {
background-color: lightblue;
display: flex;
flex-direction: column;
align-items: center;
}
.portfolio#portfolio_fixed {
background-color: orange;
}
.portfolio h1 {
font-style: 500px;
}
.portfolio ul {
margin: 10px;
padding: 0;
list-style: none;
display: flex;
}
.portfolio ul li {
font-size: 14px;
margin-right: 9px;
padding: 7px;
border-radius: 10px;
cursor: pointer;
}
.portfolio ul li.active {
background-color: #445566;
color: white;
}
.portfolio .container {
width: 70%;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
.portfolio .container .item {
width: 220px;
height: 150px;
border-radius: 20px;
border: 1px solid #f0eaea;
margin: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
color: white;
position: relative;
}
.portfolio .container .item h3 {
position: absolute;
font-style: 20px;
}
.portfolio .container .item img {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
z-index: 1;
}
.portfolio .container .item:hover {
background-color: #445566;
}
.portfolio .container .item:hover img {
opacity: 0;
z-index: 0;
}
<div class="portfolio" id="portfolio_fixed">
<h1>Portfolio</h1>
<ul>
<li class="active">Featured</li>
<li>Web app</li>
<li>Mobile app</li>
<li>Design</li>
<li>Branding</li>
</ul>
<div class="container">
<div class="item">
<img src="assets/default-product-image.png" alt="" />
<h3>Coming soon</h3>
</div>
</div>
<div class="container">
<div class="item">
<img src="assets/default-product-image.png" alt=""/>
<h3>Coming soon</h3>
</div>
</div>
<div class="container">
<div class="item">
<img src="assets/default-product-image.png" alt=""/>
<h3>Coming soon</h3>
</div>
</div>
</div>
<div class="portfolio" id="portfolio_broken">
<h1>Portfolio</h1>
<ul>
<li class="active">Featured</li>
<li>Web app</li>
<li>Mobile app</li>
<li>Design</li>
<li>Branding</li>
</ul>
<div class="container">
<div class="item">
<img src="assets/default-product-image.png" alt="" />
<h3>Coming soon</h3>
</div>
<div class="container">
<div class="item">
<img src="assets/default-product-image.png" alt=""/>
<h3>Coming soon</h3>
</div>
<div class="container">
<div class="item">
<img src="assets/default-product-image.png" alt=""/>
<h3>Coming soon</h3>
</div>
</div>
</div>
</div>
</div>

Active link border/underline

I would like to put an underline on the active icon link. I am able to underline but it is too close to the icon but I want to underline at the bottom-top of the navigation bar as shown in the image below.
* {
margin: 0;
padding: 0;
}
.header {
display: flex;
justify-content: space-between;
padding: 15px 20px;
position: sticky;
background-color: white;
z-index: 100;
top: 0;
box-shadow: 0px 5px 8px -9px rgba(0, 0, 0, 75);
}
.header__left>img {
height: 40px;
}
.header__center {
display: flex;
flex-direction: row;
justify-content: center;
}
.header__option {
display: flex;
align-items: center;
padding: 0 2vw;
cursor: pointer;
height: 52px;
}
.header__right {
display: flex;
}
.header__info {
display: flex;
align-items: center;
padding-right: 12px;
}
.header__info>span {
margin-left: 10px;
}
.header__option.active>i {
color: #1877f2;
border-bottom: 1px solid red;
border-bottom-width: 3px;
bottom: 0;
}
.header__option:hover {
background-color: #f0f2f5;
border-top-left-radius: 1px;
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
border-bottom-left-radius: 1px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" rel="stylesheet" />
<div class="header">
<div class="header__left">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Free_logo.svg/600px-Free_logo.svg.png" />
</div>
<div class="header__center">
<div class="header__option active">
<i class="fas fa-home"></i>
</div>
<div class="header__option">
<i class="fas fa-users"></i>
</div>
<div class="header__option">
<i class="fas fa-video"></i>
</div>
</div>
<div class="header__right">
<div class="header__info">
<i class="fas fa-user-circle fa-lg"></i>
<span class="header__info__name">Aakash</span>
</div>
</div>
</div>
What is the way of underlining the icon with the exact width that is taken while hovering over the icons?
You need to apply the border on the parent element of the icon
* {
margin: 0;
padding: 0;
}
.header {
display: flex;
justify-content: space-between;
padding: 15px 20px 0px 20px; /* was padding: 15px 20px */
position: sticky;
background-color: white;
z-index: 100;
top: 0;
box-shadow: 0px 5px 8px -9px rgba(0, 0, 0, 75);
}
/* added below four lines for image centering */
.header__left {
display: flex;
align-items: center;
}
.header__left>img {
height: 40px;
}
.header__center {
display: flex;
flex-direction: row;
justify-content: center;
}
.header__option {
display: flex;
align-items: center;
padding: 0 2vw;
cursor: pointer;
height: 52px;
}
.header__right {
display: flex;
}
.header__info {
display: flex;
align-items: center;
padding-right: 12px;
}
.header__info>span {
margin-left: 10px;
}
/* added below four lines for bottom border on active link */
.header__option.active {
border-bottom: 1px solid red;
border-bottom-width: 3px;
}
.header__option.active>i {
color: #1877f2;
/* removed border-bottom, border-bottom-width and bottom rules */
}
.header__option:hover {
background-color: #f0f2f5;
border-top-left-radius: 1px;
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
border-bottom-left-radius: 1px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog==" crossorigin="anonymous" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" rel="stylesheet" />
<div class="header">
<div class="header__left">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Free_logo.svg/600px-Free_logo.svg.png" />
</div>
<div class="header__center d-none d-xl-flex d-md-flex">
<div class="header__option active">
<i class="fas fa-home"></i>
</div>
<div class="header__option">
<i class="fas fa-users"></i>
</div>
<div class="header__option">
<i class="fas fa-video"></i>
</div>
</div>
<div class="header__right">
<div class="header__info d-none d-xl-flex">
<i class="fas fa-user-circle fa-lg"></i>
<span class="header__info__name">Aakash</span>
</div>
</div>
</div>
It's better to use pseudo elements (::after & ::before) for active states and for the underline.
.header__option{
position: relative;
}
.header__option.active::after{
content:'';
position: absolute;
bottom: -10px; (set it accordingly)
left: 0;
width: 100%;
height: 1px;
background: red;
}
* {
margin: 0;
padding: 0;
}
.header {
display: flex;
justify-content: space-between;
padding: 15px 20px 0;
position: sticky;
background-color: white;
z-index: 100;
top: 0;
box-shadow: 0px 5px 8px -9px rgba(0, 0, 0, 75);
}
.header__left>img {
height: 40px;
}
.header__center {
display: flex;
flex-direction: row;
justify-content: center;
}
.header__option {
display: flex;
align-items: center;
padding: 0 2vw;
cursor: pointer;
height: 52px;
}
.header__right {
display: flex;
}
.header__info {
display: flex;
align-items: center;
padding-right: 12px;
}
.header__info>span {
margin-left: 10px;
}
.header__option.active {
color: #1877f2;
border-bottom: 1px solid red;
border-bottom-width: 3px;
}
.header__option:hover {
background-color: #f0f2f5;
border-top-left-radius: 1px;
border-top-right-radius: 1px;
border-bottom-right-radius: 1px;
border-bottom-left-radius: 1px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog==" crossorigin="anonymous" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" rel="stylesheet" />
<div class="header">
<div class="header__left">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Free_logo.svg/600px-Free_logo.svg.png" />
</div>
<div class="header__center d-none d-xl-flex d-md-flex">
<div class="header__option active">
<i class="fas fa-home"></i>
</div>
<div class="header__option">
<i class="fas fa-users"></i>
</div>
<div class="header__option">
<i class="fas fa-video"></i>
</div>
</div>
<div class="header__right">
<div class="header__info d-none d-xl-flex">
<i class="fas fa-user-circle fa-lg"></i>
<span class="header__info__name">Aakash</span>
</div>
</div>
</div>
Here is the working example:
* {
margin: 0;
padding: 0;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
background-color: white;
z-index: 100;
top: 0;
box-shadow: 0px 5px 8px -9px rgba(0, 0, 0, 75);
padding-left: 15px;
padding-right: 15px;
}
.header__left>img {
height: 40px;
}
.header__left .header__option, .header__right .header__option, .header__center .header__option {
height: 60px;
min-width: 60px;
}
.header__center {
display: flex;
flex-direction: row;
justify-content: center;
}
.header__option {
display: flex;
align-items: center;
padding: 0 2vw;
cursor: pointer;
justify-content: center;
}
.header__right {
display: flex;
}
.header__info {
display: flex;
align-items: center;
padding-right: 12px;
}
.header__info>span {
margin-left: 10px;
}
.header__option.active, .header__option.active:hover {
color: #1877f2;
border-bottom: 1px solid red;
border-bottom-width: 3px;
}
.header__option:hover {
background-color: #f0f2f5;
border-bottom: 1px solid #dedede;
border-bottom-width: 3px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog==" crossorigin="anonymous" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" rel="stylesheet" />
<div class="header">
<div class="header__left">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Free_logo.svg/600px-Free_logo.svg.png" />
</div>
<div class="header__center">
<div class="header__option active">
<i class="fas fa-home"></i>
</div>
<div class="header__option">
<i class="fas fa-users"></i>
</div>
<div class="header__option">
<i class="fas fa-video"></i>
</div>
</div>
<div class="header__right">
<div class="header__info d-none d-xl-flex">
<i class="fas fa-user-circle fa-lg"></i>
<span class="header__info__name">Aakash</span>
</div>
</div>
</div>

Need to show a inner DIV outside PARENT div with `overflow:auto`?

Sharing here the demo UI. In this UI, I would want to show the CALENDAR outside the parent window just by using CSS. The Calendar should overflow over the Submit/cancel button div n outside that too]1
Code snippet:
Here, the class date-picker-wrp should come outside the complete MODAL box.
.modalwindow {
z-index: auto;
position: fixed;
box-shadow: 0 0 20px #333;
background-color: #fff;
border-radius: 0;
overflow: inherit;
transform: translate(-50%,-50%);
left: 50%;
top: 50%;
}
.zc-form > div {
max-height: 80vh;
display: flex;
flex-direction: column;
height: 100%;
width: 550px;
position: relative;
border-radius: 5px;
overflow: hidden;
}
.zc-form-body {
max-height: 500px;
overflow: auto;
padding: 10px 30px 30px;
}
.posrel {
position: relative;
}
.zc-form-input{
border-radius: 4px;
line-height: 33px;
padding: 0 18px 0 15px;
font-size: 14px;
color: #2d3138;
position: relative;
height: 35px;
border: solid 0.5px #dedede;
background-color: #fff;
}
.date-picker-wrp{
position: absolute;
border-radius: 4px;
overflow: hidden;
background-color: #fff;
z-index: 1000;
box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px 0px;
width: 100%;
margin-top: 2px;
}
.datepicker{
text-align: left;
padding: 10px 7px;
}
.zc-form-footer{
height: 85px;
background-color: #fff;
display: flex;
align-items: center;
padding: 0 30px;
justify-content: space-between;
flex-shrink: 0;
box-shadow: 0px 0px 5px 0 rgba(0, 0, 0, 0.21);
z-index: 1;
}
<div id="form_dialog" type="popup" class="modalwindow zc-form zcalgncntr zcbg_mask">
<div>
<div id="winhead" class="mheader ">Create Modal</div>
<section class="zc-form-body">
<div inputs="">
<div class="font14 mrgT20 posrel">
<div class="zc-form-input-hdr">
<span>date</span>
<span class="clr9 zc-form-hint">Enter the due date</span>
</div>
<div class="posrel cur">
<input placeholder="Ex : 2018/10/11" class="zc-form-input zc-form-date-prvw textL cur">
<span class="zc-form-icons">
<div loading="" class="form-input-loader dN">
<span></span>
<span></span>
<span></span>
</div>
<span class="msi-calndr zcclr font15"></span>
<span class="msi-close zcclr"></span>
</span>
<div class="date-picker-wrp" style="display: block;">
<div element="calendar" class="date-picker">
<div class="datepicker" style="display: block;">
<div class="datepickerContainer" style="width: 0px; height: 0px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="zc-form-footer">
<div class="w100 h100 dflx fjustifySB">
<div class="flexC">
<button class="buttn_pos">Add Task</button>
<button class="buttn_neg btn evbtn mrgR20">Cancel</button> </div>
</div>
</footer>
</div>
</div>
Expected result:
I want the calendar dom to appear like the dropdown in below shortcut, but ONLY BY USING PURE CSS ( no javascript calculation)
Please refer this JS Fiddle link: https://jsfiddle.net/dilip96025/gzh26fej/28/
Here, the Country dropdown should come outside the box with con class.
As far as I could reproduce your problem with your current included code, you need to remove overflow: hidden from .zc-form > div and remove overflow: auto from .zc-form-body. The cause of your problem was that overflow: hidden really hides everything that goes beyond its own height and width.
.modalwindow {
z-index: auto;
position: fixed;
box-shadow: 0 0 20px #333;
background-color: #fff;
border-radius: 0;
overflow: inherit;
transform: translate(-50%, -50%);
left: 50%;
top: 50%;
}
.zc-form > div {
max-height: 80vh;
display: flex;
flex-direction: column;
height: 100%;
width: 550px;
position: relative;
border-radius: 5px;
}
.zc-form-body {
max-height: 500px;
padding: 10px 30px 30px;
}
.posrel {
position: relative;
}
.zc-form-input {
border-radius: 4px;
line-height: 33px;
padding: 0 18px 0 15px;
font-size: 14px;
color: #2d3138;
position: relative;
height: 35px;
border: solid 0.5px #dedede;
background-color: #fff;
}
.date-picker-wrp {
position: absolute;
border-radius: 4px;
overflow: hidden;
background-color: #fff;
z-index: 1000;
box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px 0px;
width: 100%;
margin-top: 2px;
}
.datepicker {
text-align: left;
padding: 10px 7px;
}
.zc-form-footer {
height: 85px;
background-color: #fff;
display: flex;
align-items: center;
padding: 0 30px;
justify-content: space-between;
flex-shrink: 0;
box-shadow: 0px 0px 5px 0 rgba(0, 0, 0, 0.21);
z-index: 1;
}
<div id="form_dialog" type="popup" class="modalwindow zc-form zcalgncntr zcbg_mask">
<div>
<div id="winhead" class="mheader ">Create Modal</div>
<section class="zc-form-body">
<div inputs="">
<div class="font14 mrgT20 posrel">
<div class="zc-form-input-hdr">
<span>date</span>
<span class="clr9 zc-form-hint">Enter the due date</span>
</div>
<div class="posrel cur">
<input placeholder="Ex : 2018/10/11" class="zc-form-input zc-form-date-prvw textL cur">
<span class="zc-form-icons">
<div loading="" class="form-input-loader dN">
<span></span>
<span></span>
<span></span>
</div>
<span class="msi-calndr zcclr font15"></span>
<span class="msi-close zcclr"></span>
</span>
<div class="date-picker-wrp" style="display: block;">
test1<br>
test2<br>
test3<br>
test4<br>
test5<br>
test6<br>
<div element="calendar" class="date-picker">
<div class="datepicker" style="display: block;">
<div class="datepickerContainer" style="width: 0px; height: 0px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="zc-form-footer">
<div class="w100 h100 dflx fjustifySB">
<div class="flexC">
<button class="buttn_pos">Add Task</button>
<button class="buttn_neg btn evbtn mrgR20">Cancel</button> </div>
</div>
</footer>
</div>
</div>
Edit: second code snippet in answer to comment.
.modalwindow {
z-index: auto;
position: fixed;
box-shadow: 0 0 20px #333;
background-color: #fff;
border-radius: 0;
overflow: inherit;
transform: translate(-50%, -50%);
left: 50%;
top: 50%;
}
.zc-form > div {
max-height: 80vh;
display: flex;
flex-direction: column;
height: 100%;
width: 550px;
position: relative;
border-radius: 5px;
}
.zc-form-body {
max-height: 500px;
overflow: auto;
padding: 10px 30px 30px;
}
.posrel {
position: relative;
}
.zc-form-input {
border-radius: 4px;
line-height: 33px;
padding: 0 18px 0 15px;
font-size: 14px;
color: #2d3138;
position: relative;
height: 35px;
border: solid 0.5px #dedede;
background-color: #fff;
}
.date-picker-wrp {
position: absolute;
border-radius: 4px;
overflow: hidden;
background-color: #fff;
z-index: 1000;
box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px 0px;
width: 100%;
margin-top: 2px;
}
.datepicker {
text-align: left;
padding: 10px 7px;
}
.zc-form-footer {
height: 85px;
background-color: #fff;
display: flex;
align-items: center;
padding: 0 30px;
justify-content: space-between;
flex-shrink: 0;
box-shadow: 0px 0px 5px 0 rgba(0, 0, 0, 0.21);
z-index: 1;
}
<div id="form_dialog" type="popup" class="modalwindow zc-form zcalgncntr zcbg_mask">
<div>
<div id="winhead" class="mheader ">Create Modal</div>
<section class="zc-form-body">
<div inputs="">
<div class="font14 mrgT20 posrel">
<div class="zc-form-input-hdr">
<span>date</span>
<span class="clr9 zc-form-hint">Enter the due date</span>
</div>
<div class="posrel cur">
<input placeholder="Ex : 2018/10/11" class="zc-form-input zc-form-date-prvw textL cur">
<span class="zc-form-icons">
<div loading="" class="form-input-loader dN">
<span></span>
<span></span>
<span></span>
</div>
<span class="msi-calndr zcclr font15"></span>
<span class="msi-close zcclr"></span>
</span>
<div class="date-picker-wrp" style="display: block;">
test1<br>
test2<br>
test3<br>
test4<br>
test5<br>
test6<br>
<div element="calendar" class="date-picker">
<div class="datepicker" style="display: block;">
<div class="datepickerContainer" style="width: 0px; height: 0px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="zc-form-footer">
<div class="w100 h100 dflx fjustifySB">
<div class="flexC">
<button class="buttn_pos">Add Task</button>
<button class="buttn_neg btn evbtn mrgR20">Cancel</button> </div>
</div>
</footer>
</div>
</div>
In the calendar's css add "z-index:1000"
Eg:
<div class="calendar" style="z-index:1000"></div>

How to align contents inside flexbox

I 've got 3 items and need to align their contents horizontally, in center. So itemAContainer and itemCContainer will displayed as itemB in the middle and not at the left side..(White bordered Boxes)
Is there anyway to do this without changing itemAContainer and itemCContainer and their childs? I tried many solutions with no luck.
#wrapper {padding-top:2px;color:#ff0000;background:#3a3a39;border-radius:4px; margin-top:44px; width:100%;}
.section-wrapper {display: flex;height: 100%;display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex;
align-items: center; justify-content: center;}
.left, .center, .right {min-width: 166px;}
.left { flex: 0 33%;}
.center { flex: 33%;}
.right { flex: 0 33%;}
.home-left {margin:-1px 4px -1px -4px; border:1px solid #fff;border-top-left-radius:8px; border-bottom-left-radius:8px;border-top-right-radius:8px;border-bottom-right-radius:8px;z-index:1;}
.home-center {display:table-cell; background-color:#3a3a39; margin:-1px 4px -1px -4px; width:33.3%; text-align:center;z-index:1;}
.home-right {margin-right:2px;border:1px solid #fff;border-top-left-radius:8px;border-bottom-left-radius:8px;border-top-right-radius:8px;border-bottom-right-radius:8px;z-index:1;}
<div id="wrapper">
<div class="section-wrapper">
<div class="left">
<div class="home-left">
<div id="itemAContainer" style="position:relative;width:168px; height:440px;">
<div id="itemAImage" style="position: absolute; bottom: 0;">
<img src="https://i.imgsafe.org/191427cf89.png" border="1" style="width:166px;height:420px;z-index:10;">
</div>
</div>
</div>
</div>
<div class="center"><div class="home-center"><img src="https://i.imgsafe.org/19143b4e85.png" width="166" height="420" border="1" alt=""/></div></div>
<div class="right">
<div class="home-right">
<div id="itemCContainer" style="position:relative;width:168px; height:440px;">
<div id="itemCImage" style="position: absolute; bottom: 0;">
<img src="https://i.imgsafe.org/191452f4ea.png" border="1" style="width:166px;height:420px;z-index:10;">
</div>
</div>
</div>
</div>
</div>
</div>
You need to make your home-left and home-right classes flex-containers as well.
#wrapper {
padding-top: 2px;
color: #ff0000;
background: #3a3a39;
border-radius: 4px;
margin-top: 44px;
width: 100%;
}
.section-wrapper {
display: flex;
height: 100%;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
align-items: center;
justify-content: center;
}
.left,
.center,
.right {
min-width: 166px;
}
.left {
flex: 0 33%;
}
.center {
flex: 33%;
}
.right {
flex: 0 33%;
}
.home-left {
margin: -1px 4px -1px -4px;
border: 1px solid #fff;
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
z-index: 1;
display: flex;
justify-content: center;
}
.home-center {
display: table-cell;
background-color: #3a3a39;
margin: -1px 4px -1px -4px;
width: 33.3%;
text-align: center;
z-index: 1;
}
.home-right {
margin-right: 2px;
border: 1px solid #fff;
border-top-left-radius: 8px;
border-bottom-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
z-index: 1;
display: flex;
justify-content: center;
}
<div id="wrapper">
<div class="section-wrapper">
<div class="left">
<div class="home-left">
<div id="itemAContainer" style="position:relative;width:168px; height:440px;">
<div id="itemAImage" style="position: absolute; bottom: 0;">
<img src="https://i.imgsafe.org/191427cf89.png" border="1" style="width:166px;height:420px;z-index:10;">
</div>
</div>
</div>
</div>
<div class="center">
<div class="home-center">
<img src="https://i.imgsafe.org/19143b4e85.png" width="166" height="420" border="1" alt="" />
</div>
</div>
<div class="right">
<div class="home-right">
<div id="itemCContainer" style="position:relative;width:168px; height:440px;">
<div id="itemCImage" style="position: absolute; bottom: 0;">
<img src="https://i.imgsafe.org/191452f4ea.png" border="1" style="width:166px;height:420px;z-index:10;">
</div>
</div>
</div>
</div>
</div>
</div>

Flexbox overlapping absoluted positioned childrens

I got a problem with flexbox containers with absolute positioned childrens.
FIDDLE; if the window getting smaller (in width) the titles getting smaller, what is absolutly correct, the problem is in the digits that are overlapping over the other watches. I tested a bit around with z-Index, background-color but doesn't get anything work.
HTML:
<div class="stopwatch">
<div class="stopwatch__panel">
<div class="stopwatch__header">
<div class="stopwatch__title">Random Title 404531</div>
</div>
<div class="stopwatch__body">
<div class="stopwatch__counter">
<div class="stopwatch__segment stopwatch__segment--five">
<div class="stopwatch__segmentTopLeft"></div>
<div class="stopwatch__segmentTop"></div>
<div class="stopwatch__segmentTopRight"></div>
<div class="stopwatch__segmentMiddle">
<div class="stopwatch__segmentMiddleTop"></div>
<div class="stopwatch__segmentMiddleBottom"></div>
</div>
<div class="stopwatch__segmentBottomLeft"></div>
<div class="stopwatch__segmentBottom"></div>
<div class="stopwatch__segmentBottomRight"></div>
</div>
<div class="stopwatch__segment stopwatch__segment--five">
<div class="stopwatch__segmentTopLeft"></div>
<div class="stopwatch__segmentTop"></div>
<div class="stopwatch__segmentTopRight"></div>
<div class="stopwatch__segmentMiddle">
<div class="stopwatch__segmentMiddleTop"></div>
<div class="stopwatch__segmentMiddleBottom"></div>
</div>
<div class="stopwatch__segmentBottomLeft"></div>
<div class="stopwatch__segmentBottom"></div>
<div class="stopwatch__segmentBottomRight"></div>
</div>
</div>
</div>
</div>
<div class="stopwatch__panel">
<div class="stopwatch__header">
<div class="stopwatch__title">Random Title 714895</div>
</div>
<div class="stopwatch__body">
<div class="stopwatch__counter">
<div class="stopwatch__segment stopwatch__segment--nine">
<div class="stopwatch__segmentTopLeft"></div>
<div class="stopwatch__segmentTop"></div>
<div class="stopwatch__segmentTopRight"></div>
<div class="stopwatch__segmentMiddle">
<div class="stopwatch__segmentMiddleTop"></div>
<div class="stopwatch__segmentMiddleBottom"></div>
</div>
<div class="stopwatch__segmentBottomLeft"></div>
<div class="stopwatch__segmentBottom"></div>
<div class="stopwatch__segmentBottomRight"></div>
</div>
</div>
</div>
</div>
</div>
CSS:
.stopwatch {
position: fixed;
right: 0;
bottom: 0;
display: flex;
justify-content: flex-end;
align-items: flex-end;
max-width: 100%;
width: 100%;
}
.stopwatch__panel {
background-color: #ffffff;
border: 1px solid #dddddd;
display: flex;
flex-flow: column;
min-width: 0;
}
.stopwatch__header {
background-color: #f5f5f5;
display: flex;
align-items: center;
order: 1;
}
.stopwatch__title {
flex: 1 1 auto;
padding: 5px;
border-left: 1px solid #dddddd;
word-wrap: break-word;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.stopwatch__body {
display: flex;
align-items: stretch;
}
.stopwatch__counter {
background-color: #333333;
padding: 15px;
flex-grow: 1;
text-align: center;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
.stopwatch__segment {
position: relative;
float: left;
margin: 6px;
width: 18px;
height: 35px;
transition: all 200ms ease-in-out;
}
.stopwatch__segment--zero .stopwatch__segmentTopRight {
border-right-color: #e6e6e6;
}
/* [...all numbers from zero to nine... (only coloring borders) ] */
.stopwatch__segment--nine .stopwatch__segmentBottom {
border-bottom-color: #e6e6e6;
}
.stopwatch__segmentTop {
position: absolute;
left: 1px;
height: 0;
width: 10px;
border-top: 3px solid #424242;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
transition: all 200ms ease-in-out;
}
.stopwatch__segmentTopRight {
position: absolute;
left: 15px;
top: 1px;
height: 10px;
width: 0;
border-right: 3px solid #424242;
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
transition: all 200ms ease-in-out;
}
/* [... the other segments parts ...] */
add overflow:hidden; to .stopwatch__counter
.stopwatch__counter {
background-color: #333333;
padding: 15px;
flex-grow: 1;
text-align: center;
color: #ffffff;
display: flex;
overflow:hidden;
align-items: center;
justify-content: center; }
see this fiddle:
https://jsfiddle.net/grassog/jcgyce3g/2/

Resources