This is my goal:
Some circular buttons that have an hover state: on mouseover, a black container with some text (with different length) should appear growing from left to right.
I didn't know how to do that. My doubts are about how to set the two different width because it should be from 0 to auto but if it's 0, then mouseover can't work.
Here is my sample code:
.container {
background-color: lightgray;
width: 60px;
height: 100px;
padding-top: 20px;
padding-left: 20px;
}
.item-container {
position: relative;
overflow: visible;
}
.item {
border-radius: 100%;
padding: 8px;
width: 10px;
height: 10px;
cursor: pointer;
background-color: white;
border: 1px solid black;
}
.circle {
width: 10px;
height: 10px;
border-radius: 100%;
background-color: tomato;
}
.hovered-elem {
position: absolute;
top: 0px;
left: 0px;
width: auto;
height: 100%;
white-space: nowrap;
cursor: pointer;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 30px;
padding-right: 15px
}
.hovered-elem-text-container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
white-space: nowrap;
padding-left: 40px;
color: white;
}
<div class="container">
<div class="item-container">
<div class="item">
<div class="circle"/>
</div>
<div class="hovered-elem">
<div class="hovered-elem-text-container">
Lilly Martin
</div>
</div>
</div>
<div>
Here's a start. I think it's all pretty self-explanatory. The max-width on the text elements is arbitrary--set it to something that will fit all possible names.
I simplified the markup a bit. You could take it further by making the inner circles pseudo-elements if you like.
* {
box-sizing: border-box;
}
.container {
display: inline-block;
background-color: #ddd;
width: 62px;
padding-left: 10px;
}
.item {
display: inline-flex;
align-items: center;
border-radius: 32px;
padding: 8px;
margin: 16px 0;
cursor: pointer;
border: 1px solid black;
background: white;
font-family: Verdana, Arial, sans-serif;
transition: all .5s;
}
.circle {
width: 24px;
height: 24px;
border-radius: 100%;
background-color: #CD4025;
}
.item:nth-child(2) .circle {
background-color: #0097A7;
}
.item:nth-child(3) .circle {
background-color: #FFAC40;
}
.text {
color: #fff;
max-width: 0;
overflow: hidden;
white-space: nowrap;
transition: all 1s;
}
.item:hover {
background: #000;
transition: all .5s;
}
.item:hover .text {
max-width: 200px;
margin: 0 16px;
transition: all 1s;
}
<div class="container">
<div class="item">
<div class="circle"></div>
<div class="text">Lilly Martin</div>
</div>
<div class="item">
<div class="circle"></div>
<div class="text">Philip McDaniel</div>
</div>
<div class="item">
<div class="circle"></div>
<div class="text">Tom Bombadil</div>
</div>
</div>
You can do this CSS transitions and altering the scale of the div while the circle item is hovered. Take a look what I did here:
.container {
background-color: lightgray;
width: 60px;
height: 100px;
padding-top: 20px;
padding-left: 20px;
}
.item-container {
position: relative;
overflow: visible;
}
.item {
border-radius: 100%;
padding: 8px;
width: 10px;
height: 10px;
cursor: pointer;
background-color: white;
border: 1px solid black;
}
.circle {
width: 10px;
height: 10px;
border-radius: 100%;
background-color: tomato;
}
.hovered-elem {
position: absolute;
top: 0px;
left: 0px;
width: auto;
height: 100%;
white-space: nowrap;
cursor: pointer;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 30px;
padding-right: 15px;
scale: 0;
transform-origin: left;
transition: all 200ms ease-in-out;
}
.hovered-elem-text-container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
white-space: nowrap;
padding-left: 40px;
color: white;
}
.item:hover .hovered-elem{
scale: 1;
}
<div class="container">
<div class="item-container">
<div class="item">
<div class="circle"/>
</div>
<div class="hovered-elem">
<div class="hovered-elem-text-container">
Lilly Martin
</div>
</div>
</div>
<div>
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I am trying to shrink upload-container and img-vector when the screen size is reduced but it seems that the upload container is not shrinking in size. I am new to CSS and I am unable to figure out the problem.
Link to my pen
body,
#main-container,
.upload-container,
.drop-zone {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
body,
.upload-container,
.drop-zone {
flex-direction: column;
}
#main-container {
background-color: green;
justify-content:space-around;
width: 100%;
margin: auto;
}
.image-vector {
width: 50vw;
height: 50vh;
flex-shrink: 1;
background: url(https://picsum.photos/200) no-repeat center;
background-size: contain;
}
.upload-container {
background: #17191c;
border-radius: 25px;
flex-shrink: 1;
}
I just added the following code in Responsive Mode. With flex-flow: row wrap; I changed the flex-direction to row and flex-warp to warp break in overflow mode.
#main-container,
.upload-container,
.drop-zone {
flex-flow: row wrap;
}
:root {
--main-bg-color: #212429;
--light-blue: #3a9aed;
--border-color: #3a9aed;
--container-width: 500px;
}
* {
margin: 0px;
padding: 0px;
}
body {
font-family: system-ui;
background: var(--main-bg-color);
height: 98vh;
overflow: hidden;
color: white;
}
body,
#main-container,
.upload-container,
.drop-zone {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
body,
.upload-container,
.drop-zone {
flex-direction: column;
}
.header-container {
position: absolute;
top: 4%;
font-family: Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
font-size: 55px;
}
#main-container {
background-color: green;
/* justify-content:space-around; */
width: 100%;
margin: auto;
}
.footer-container {
position: absolute;
top: 2%;
left: 80%;
}
.image-vector {
width: 50vw;
height: 50vh;
flex-shrink: 1;
background: url(https://picsum.photos/200) no-repeat center;
background-size: contain;
}
.upload-container {
background: #17191c;
border-radius: 25px;
flex-shrink: 1;
}
.drop-zone {
width: var(--container-width);
min-height: 200px;
border: 2px dashed var(--border-color);
border-radius: 10px;
margin: 30px;
transition: 0.2s all ease-in;
}
/* will be added when user drags */
.drop-zone.dragged {
background: var(--main-bg-color);
border-color: #0288d1;
}
.drop-zone input {
display: none;
}
.icon-container {
position: relative;
width: 75px;
height: 100px;
}
.icon-container img {
width: 75px;
position: absolute;
transition: transform 0.25s ease-in-out;
transform-origin: bottom;
}
.icon-container .center {
z-index: 10;
}
.icon-container .right,
.icon-container .left {
filter: grayscale(0.5);
transform: scale(0.9);
}
.dragged .center {
transform: translateY(-5px);
}
.dragged .right {
transform: rotate(10deg) scale(0.9) translateX(20px);
}
.dragged .left {
transform: rotate(-10deg) scale(0.9) translateX(-20px);
}
.title {
font-size: large;
}
#browseBtn {
color: #2196f3;
cursor: pointer;
}
/* uploading progress styles */
.progress-container {
border: 2px solid var(--main-bg-color);
width: var(--container-width);
height: 70px;
border-radius: 10px;
margin-bottom: 25px;
position: relative;
display: none;
}
.progress-container .inner-container {
margin: 10px 15px;
z-index: 2;
position: absolute;
width: calc(100% - 30px);
}
.progress-container .percent-container {
font-size: 14px;
margin: 5px;
opacity: 0.7;
}
.progress-container .bg-progress {
position: absolute;
background: var(--main-bg-color);
width: 100%;
height: 100%;
z-index: 1;
transition: transform 250ms linear;
transform: scaleX(0);
transform-origin: left;
}
.progress-container .progress-bar {
width: 100%;
height: 3px;
border-radius: 2px;
background: #03a9f4;
transition: transform 200ms linear;
transform: scaleX(0);
transform-origin: left;
}
/* sharing container style */
.sharing-container {
margin-bottom: 25px;
width: var(--container-width);
border-radius: 10px;
display: none;
}
.sharing-container p {
text-align: center;
}
.sharing-container .expire {
font-size: 16px;
opacity: 0.7;
margin-top: 0;
}
.sharing-container .input-container {
display: flex;
position: relative;
width: 100%;
margin-bottom: 20px;
}
.sharing-container .input-container input {
width: 100%;
border-radius: 3px;
padding: 10px 15px;
font-size: 20px;
border: 2px dashed var(--border-color);
border-radius: 6px;
background: #17191c;
color: #ffffff;
}
.sharing-container img {
height: 22px;
width: 30px;
position: absolute;
right: 7px;
top: 12px;
cursor: pointer;
background: #17191c;
color: #ffffff;
}
.email-container form {
border: 2px solid var(--border-color);
width: 100%;
padding: 15px;
box-sizing: border-box;
border-radius: 10px;
display: flex;
flex-direction: column;
align-items: center;
}
.email-container,
.send-btn-container {
display: flex;
flex-direction: column;
align-items: center;
}
.email-container label {
margin: 5px;
font-size: 18px;
}
.email-container input {
border: none;
border-bottom: 2px solid var(--border-color);
height: 19px;
font-size: 18px;
text-align: center;
}
.email-container input:focus {
outline: none;
}
.email-container .filed {
margin-bottom: 5px;
display: flex;
justify-content: space-between;
width: 400px;
}
.send-btn-container button {
font-size: 18px;
padding: 8px 40px;
margin-top: 15px;
background: #3a9aed;
border: none;
border-radius: 5px;
color: #ffffff;
cursor: pointer;
}
.toast {
position: absolute;
bottom: 10px;
right: 50%;
transform: translate(50%, 60px);
padding: 10px 20px;
background: var(--light-blue);
color: #fff;
border-radius: 5px;
font-size: 18px;
box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.1),
0px 4px 6px -2px rgba(0, 0, 0, 0.05);
transition: transform ease-in-out 0.2s;
}
.image-vector {
background: url("https://picsum.photos/200") no-repeat center;
background-size: contain;
height: 50vh;
width: 50vw;
}
.show.toast {
transform: translate(50%, 0);
}
#media screen and (max-width: 900px) {
:root {
--container-width: 320px;
}
body,
#main-container,
.upload-container,
.drop-zone {
flex-flow: row wrap;
}
.email-container .filed {
flex-direction: column;
}
.email-container .filed {
width: 300px;
}
}
<div class="header-container">EZ Sharing</div>
<main id='main-container'>
<section class="upload-container">
<form action="">
<div class="drop-zone">
<div class="icon-container">
<img src="https://picsum.photos/200" draggable="false" class="center" alt="File Icon" />
<img src="https://picsum.photos/200" draggable="false" class="left" alt="File Icon" />
<img src="https://picsum.photos/200" draggable="false" class="right" alt="File Icon" />
</div>
<input type="file" id="fileInput" />
<div class="title">
Drop your Files here or,
<span id="browseBtn">Browse</span>
</div>
</div>
</form>
<div class="progress-container">
<div class="bg-progress"></div>
<div class="inner-container">
<div class="status">Uploading...</div>
<div class="percent-container">
<span class="percentage" id="progressPercent">0 %</span>
</div>
<div class="progress-bar"></div>
</div>
</div>
<div class="sharing-container">
<p class="expire">Link expires in 24 hrs</p>
<div class="input-container">
<input type="text" id="fileURL" readonly />
<img src="./copy-icon.svg" id="copyURLBtn" alt="copy to clipboard icon" />
</div>
<p class="email-info">Or Send via Email</p>
<div class="email-container">
<form id="emailForm">
<div class="filed">
<label for="fromEmail">Your email</label>
<input type="email" autocomplete="email" required name="from-email" id="fromEmail" />
</div>
<div class="filed">
<label for="toEmail">Receiver's email</label>
<input type="email" required autocomplete="receiver" name="to-email" id="toEmail" />
</div>
<div class="send-btn-container">
<button type="submit">Send</button>
</div>
</form>
</div>
</div>
</section>
<div class="image-vector"></div>
</main>
<div class="toast">Sample message</div>
<div class="footer-container">
<a href="" target="_blank">
<img border="0" alt="Facebook" src="./github-logo.svg" width="50" height="50" />
</a>
<a href="/" target="_blank">
<img border="0" alt="Facebook" src="./linkedin.svg" width="50" height="50" />
</a>
<a href="">
<img border="0" alt="Facebook" src="./facebook.svg" width="50" height="50" />
</a>
</div>
I have searched all over stack overflow but I am unable to find any clue and I am struck here. I used flex container and child items in my code to some extent but I couldn't move beyond that. Thing is when we hover a child item, a new child item need to be created as shown in the expected result. Should we need to use pseudo element or any other flex properties to achieve this. Thanks much in advance.
My code:
https://jsfiddle.net/k2qr398u/1/
My result
https://imgur.com/kRHNHuu
Expected result:
https://imgur.com/2B6CkYF
/**CSS**/
body {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
background-color: #400017;
}
.img-css {
width: 50px;
height: 50px;
}
.main-heading {
display: block;
text-align: center;
color: #fc065d;
margin-bottom: 70px;
}
.img-js {
width: 50px;
height: 50px;
}
.container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
border: 3px solid #360310;
max-width: 610px;
height: 310px;
text-align: center;
margin: 0 auto;
flex-direction: row;
/* transform: translate(-50%,-50%); */
}
.col {
width: 130px;
height: 100px;
margin: 0 auto;
border: 3px solid #5e0a1f;
padding-top: 44px;
padding-left: 26px;
padding-right: 26px;
color: #fff;
background-color: #010001;
border-radius: 30px;
z-index: 20;
/* position: relative; */
}
.col p {
font-size: 16px;
font-weight: bold;
}
.col-2 p {
position: relative;
top: 55px;
text-align: center;
font-weight: bold;
}
<!--**HTML**-->
<body>
<div class="container">
<div class="col col-1">
<img src="images/css.svg" alt="CSS logo" class="img-css">
<br>
<p>I am</p>
</div>
<div class="col col-2">
<p class="my-name">Sri</p>
</div>
<div class="col col-3">
<img src="images/javascript.svg" alt="JS logo" class="img-js">
<p>Developer
</p>
</div>
</div>
</body>
P.S: Sorry if this question sounds very silly or dumb, I am a beginner trying to learn web dev skillsets.
I have created something similar to your expected result. Please run the code snippet for the result.
UPDATE: To include the hover off transition.
/**CSS**/
body {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
background-color: #400017;
}
.img-css {
width: 50px;
height: 50px;
}
.main-heading {
display: block;
text-align: center;
color: #fc065d;
margin-bottom: 70px;
}
.img-js {
width: 50px;
height: 50px;
}
.container {
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
border: 3px solid #360310;
max-width: 610px;
height: 310px;
text-align: center;
margin: 0 auto;
flex-direction: row;
/* transform: translate(-50%,-50%); */
}
.col {
width: 130px;
height: 100px;
margin: 0 auto;
border: 3px solid #5e0a1f;
padding-top: 44px;
padding-left: 26px;
padding-right: 26px;
color: #fff;
background-color: #010001;
border-radius: 30px;
z-index: 20;
position: relative;
}
.col p {
font-size: 16px;
font-weight: bold;
}
/*
.col-2 p {
position: relative;
top: 55px;
text-align: center;
font-weight: bold;
}
*/
.col-1,
.col-2-1,
.col-2-2,
.col-3 {
position: absolute;
left: 0;
top: 0;
transition: 1s;
}
.wrapper {
position: relative;
}
.wrapper:hover .col-1 {
transition: 1s;
left: -200px;
}
.wrapper:hover .col-2-1 {
transition: 1s;
top: -170px;
}
.wrapper:hover .col-2-2 {
transition: 1s;
top: 170px;
}
.wrapper:hover .col-3 {
transition: 1s;
left: 200px;
}
<!--**HTML**-->
<body>
<div class="container">
<div class="wrapper">
<div class="col"> Underneath</div>
<div class="col col-1">
<img src="images/css.svg" alt="CSS logo" class="img-css">
<br>
<p>I am</p>
</div>
</div>
<div class="wrapper">
<div class="col"> Underneath</div>
<div class="col col-2-1">
<p class="my-name">Sri</p>
</div>
<div class="col col-2-2">
<p class="my-name">Pratham</p>
</div>
</div>
<div class="wrapper">
<div class="col"> Underneath</div>
<div class="col col-3">
<img src="images/javascript.svg" alt="JS logo" class="img-js">
<p>Developer
</p>
</div>
</div>
</div>
</body>
The idea is:
Overlay some content over main content.
On hover reveal it :)
.card {
width: 150px;
height: 80px;
border: 1px solid #999;
background: #ccc;
border-radius: 8px;
position: relative;
margin: 20% auto;
}
.card:hover > .o-top {
top: -80px;
background: #f00;
}
.card:hover > .o-bottom {
bottom: -80px;
}
.o-top {
top: 0;
transition: top 1.5s, background 2s;
}
.o-bottom {
bottom: 0;
transition: bottom 1.5s, background 2s;
}
.card-overlay {
position: absolute;
height: 100%;
width: 100%;
background: #333;
pointer-events: none;
color: #fff;
}
<div class="card">
<div class="card-overlay o-top">TOP OVERLAY</div>
<div class="card-overlay o-bottom">BOTTOM OVERLAY</div>
<H3>INTERNAL CONTENT</H3>
</div>
Hey!
As you see in the picture I want to move the existing chatwindow to the right side where the red box is.
And I also need the box to change the height of itself when the window is made smaller.
The grid is from semantic.ui.
EDIT: On some request the whole css and parent html container is given. Hope this helps to solve the problem.
Thanks!
HTML:
<div class="two column doubling ui grid">
<div class="column">
<div class="ui segment">
1
</div>
</div>
<div class="computer only column">
<div class="chat_window">
<div class="top_menu">
<div class="buttons">
<div class="button maximize">
<h4 id="Online"></h4>
</div>
</div>
<div class="title">Chat</div>
</div>
<ul class="messages"></ul>
<div class="bottom_wrapper clearfix">
<div class="message_input_wrapper"><input class="message_input" placeholder="Type your message!" /></div>
<div class="send_message">
<div class="text">Send</div>
</div>
</div>
</div>
<div class="message_template">
<li class="message">
<div class="avatar"></div>
<div class="text_wrapper">
<div class="msgname"><a id="steamlink" target="_blank"><p id="msgname"></p></a></div>
<div class="text"></div>
</div>
</li>
</div>
</div>
</div>
CSS:
.chat_window {
width: 100%;
max-width: 450px;
background-color: #fff;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
background-color: #f8f8f8;
overflow: hidden;
}
.top_menu {
background-color: #fff;
width: 100%;
padding: 20px 0 15px;
box-shadow: 0 1px 30px rgba(0, 0, 0, 0.1);
}
.top_menu .buttons {
margin: 3px 0 0 20px;
position: absolute;
}
.top_menu .buttons .button {
width: 16px;
height: 16px;
border-radius: 50%;
display: inline-block;
margin-right: 10px;
position: relative;
}
.top_menu .buttons .button.close {
background-color: #f5886e;
}
.top_menu .buttons .button.minimize {
background-color: #fdbf68;
}
.top_menu .buttons .button.maximize {
background-color: #a3d063;
}
.top_menu .title {
text-align: center;
color: #bcbdc0;
font-size: 20px;
}
#Online{
margin: 0 0 0 20px;
color: #bcbdc0;
}
.messages {
position: relative;
list-style: none;
padding: 20px 10px 0 10px;
margin: 0;
height: 600px;
overflow-y: scroll;
}
.messages .message {
clear: both;
overflow: hidden;
margin-bottom: 10px;
transition: all 0.5s linear;
opacity: 0;
}
.messages .message.left .avatar {
background-size: 100%;
float: left;
}
.messages .message.left .text_wrapper {
background-color: #DFDFDF;
margin-left: 20px;
}
.messages .message .avatar {
width: 60px;
height: 60px;
border-radius: 50%;
display: inline-block;
}
.messages .message .msgname {
font-weight: bold;
}
.messages .message .text_wrapper {
display: inline-block;
padding-left: 10px;
padding-top: 5px;
padding-bottom: 5px;
border-radius: 6px;
width: calc(100% - 85px);
min-width: 100px;
position: relative;
}
.messages .message .text_wrapper .text {
font-size: 14px;
font-weight: 250;
}
.bottom_wrapper {
position: relative;
width: 100%;
background-color: #fff;
padding: 10px 10px;
bottom: 0;
}
.bottom_wrapper .message_input_wrapper {
display: inline-block;
height: 50px;
border-radius: 5px;
border: 1px solid #bcbdc0;
width: calc(100% - 100px);
position: relative;
padding: 0 20px;
}
.bottom_wrapper .message_input_wrapper .message_input {
border: none;
height: 100%;
box-sizing: border-box;
width: calc(100% - 40px);
position: absolute;
outline-width: 0;
color: gray;
}
.bottom_wrapper .send_message {
width: 90px;
height: 50px;
display: inline-block;
border-radius: 5px;
background-color: #563D7C;
color: #fff;
cursor: pointer;
transition: all 0.2s linear;
text-align: center;
float: right;
}
Picture:
Click here
I have an item has position: absolute in a container. I centered it by left: 50% and transform: translateX(-50%);. This item just contain text and i want it cover it's content and the text will nowrap as much as possible.
As we can see in the snipet below, the item have enough space but it did not increase width. It broke line. I know i can add white-space: nowrap to stop it breaking line but if the text is longer, one line can not wrap all text.
Adding width: 100% to item can not help because I want the width of item is dynamic base on it's content.
.container {
width: 300px;
height: 200px;
border: solid 1px #123;
position: absolute;
}
.item {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
background-color: #303030;
color: #FFF;
border-radius: 20px;
padding: 8px 16px;
}
<div class="container">
<div class="item">
<span>Hello. Its me. How are you?</span>
</div>
</div>
It this what you want? Use left: 0, right: 0 instead to center it then move your other styles in span.
.container {
width: 300px;
height: 200px;
border: solid 1px #123;
position: absolute;
}
.item {
position: absolute;
top: 20px;
left: 0;
right: 0;
text-align: center;
}
.item .content {
display: inline-block;
width: auto;
height: auto;
background-color: #303030;
color: #FFF;
border-radius: 20px;
padding: 8px 16px;
}
<div class="container">
<div class="item">
<div class="content">
<span>Hello. Its me. How are you?</span>
</div>
</div>
</div>
Would flexbox work for you?
.container {
width: 300px;
height: 200px;
border: solid 1px #123;
display: flex;
justify-content: center;
align-items: center;
}
.item {
background-color: #303030;
color: #FFF;
border-radius: 20px;
padding: 8px 16px;
}
<div class="container">
<div class="item">
<span>Hello. Its me. How are you? Hello. Its me. How are you? Hello. Its me. How are you? </span>
</div>
</div>
Please try this.
.container {
width: 300px;
height: 200px;
border: solid 1px #123;
position: relative;
}
.item {
margin-top: 20px;
display: flex;
justify-content: center;
}
.item span{
background-color: #303030;
color: #FFF;
border-radius: 20px;
padding: 8px 16px;
}
<div class="container">
<div class="item">
<span>Hello. Its me. How are you?</span>
</div>
</div>
Try adding center align for span tag
.container {
width: 300px;
height: 200px;
border: solid 1px #123;
position: absolute;
}
.item {
position: absolute;
top: 20px;
left: 0;
right: 0;
width: auto;
text-align: center;
}
.item .itemInner {
background-color: #303030;
color: #FFF;
border-radius: 20px;
padding: 8px 16px;
text-align: left;
margin: 0 auto;
}
<html>
<head>
</head>
<body>
<div class="container">
<div class="item">
<span class="itemInner">Hello. Its me.</span>
</div>
</div>
</body>
</html>
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;
}