I am building this calculator, which made me go insane this afternoon. I am using for the first time Grid, till now I only used flex-box...
The problem is that the buttons are going outside the div (calculator). I am building this mainly for mobile. On the mobile simulator on Chrome looked perfect, but as soon as I uploaded it and looked on it on my phone, the buttons are going WAY outside the div...I've build dozens test websites and never had this problem, everything stayed where shoul've been staying.
What am I doing wrong? I've been here for 2 hours trying to make it work and I beggining to feel stupid.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Montserrat', sans-serif;
}
body {
background: linear-gradient(90deg, rgba(0,244,147,.7), rgba(30,144,255,.7));
}
.calculator {
border: 1px solid rgb(0,0,0,.3);
width: 80vw;
height: 80vh;
margin: auto;
position: relative;
top: 50vh;
transform: translateY(-50%);
border-radius: 10px;
background: rgb(225,225,225);
box-shadow: 0 0 10px rgb(0,0,0,.7), -5px -5px 10px rgb(0,0,0,.3) inset, 5px 5px 5px rgb(255,255,255) inset;
}
.name {
width: 100%;
height: 3%;
position: absolute;
}
h5 {
display: flex;
justify-content: center;
align-items: center;
font-size: .8em;
color: rgb(0,0,0,.5);
position: relative;
top: 50%;
transform: translateY(-50%);
}
.output {
width: 90%;
height: 25%;
margin: auto;
margin-top: 5.5%;
background: white;
box-shadow: 0 0 5px rgb(0,0,0,.7) inset ;
border-radius: 3px;
}
.previous {
width: 100%;
height: 40%;
border-bottom: .5px solid rgb(0,0,0,.5);
}
.current {
width: 100%;
height: 60%;
}
.keyboardparent {
width: 90%;
height: 75%;
margin: auto;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
border:3px solid red;
}
.keyboard {
width: 100%;
height: 90%;
margin: auto;
border:3px solid black;
}
.top {
display: grid;
grid-template-columns: 2fr 1.5fr 1fr;
grid-gap: .5em;
-webkit-gap: .5em;
}
.rest {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-gap: .5em;
-webkit-grid-gap: .5em;
margin-top: .5em;
}
button {
cursor: pointer;
font-size: 1.5em;
padding: 10px;
border-radius: 10px;
border: none;
box-shadow: 0 0 3px rgba(0,0,0,.5), -3px -3px 5px rgba(0,0,0,.3) inset, 3px 3px 5px rgba(255,255,255,.8) inset;
outline: none;
background: rgba(250,250,250,.8);
}
.color {
background: rgba(0,200,197,.3);
}
button:active {
transform: scale(.95);
}
<div class="calculator">
<div class="name">
<h5>Matthew Industries INC</h5>
</div>
<div class="output">
<div class="previous"></div>
<div class="current"></div>
</div>
<div class="keyboardparent">
<div class="keyboard">
<div class="top">
<button class="colorc">C</button>
<button class="color"><img src="delete.svg" class="delete" width="20px" alt=""></button>
<button class="color">%</button>
</div>
<div class="rest">
<button>7</button>
<button>8</button>
<button>9</button>
<button class="color">/</button>
<button>4</button>
<button>5</button>
<button>6</button>
<button class="color">x</button>
<button>1</button>
<button>2</button>
<button>3</button>
<button class="color">-</button>
<button class="color">.</button>
<button>0</button>
<button class="color">=</button>
<button class="color">+</button>
</div>
</div>
</div>
</div>
I found it.
I removed the height from .calculator, gave height: 120px; to .output and added padding: 30px 0; to .keyboardparent.
Thank you for the previous solutions, I didn't think the height of the .calculator set in vh could do some damage.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Montserrat', sans-serif;
}
body {
background: linear-gradient(90deg, rgba(0,244,147,.7), rgba(30,144,255,.7));
}
.calculator {
border: 1px solid rgb(0,0,0,.3);
width: 80vw;
margin: auto;
position: relative;
top: 50vh;
transform: translateY(-50%);
border-radius: 10px;
background: rgb(225,215,215);
box-shadow: 0 0 10px rgb(0,0,0,.7), -5px -5px 10px rgb(0,0,0,.3) inset, 5px 5px 5px rgb(255,255,255) inset;
}
.name {
width: 100%;
height: 3%;
position: absolute;
}
h5 {
display: flex;
justify-content: center;
align-items: center;
font-size: .8em;
color: rgb(0,0,0,.5);
position: relative;
top: 50%;
transform: translateY(-50%);
}
.output {
width: 90%;
height: 120px;
margin: auto;
margin-top: 5.5%;
background: rgba(180,200,180);
box-shadow: 0 0 5px rgb(0,0,0,.7) inset ;
border-radius: 3px;
}
.previous {
width: 100%;
height: 40%;
border-bottom: .5px solid rgb(0,0,0,.5);
}
.current {
width: 100%;
height: 60%;
}
.keyboardparent {
width: 90%;
height: 75%;
margin: auto;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 30px 0;
}
.keyboard {
width: 100%;
height: 90%;
margin: auto;
}
.top {
display: grid;
grid-template-columns: 1.5fr 1.5fr 1fr;
grid-gap: .5em;
-webkit-gap: .5em;
}
.rest {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-gap: .5em;
-webkit-grid-gap: .5em;
margin-top: .5em;
}
button {
cursor: pointer;
font-size: 1.5em;
padding: 10px;
border-radius: 10px;
border: none;
box-shadow: 0 0 3px rgba(0,0,0,.5), -3px -3px 5px rgba(0,0,0,.3) inset, 3px 3px 5px rgba(255,255,255,.8) inset;
outline: none;
background: rgba(250,250,250,.8);
text-align: center;
vertical-align: ;
}
.color {
background: rgba(0,200,207,.3);
}
button:active {
transform: scale(.95);
}
.clearall {
background: rgba(255,0,50,.7);
}
.cancel {
background: rgba(255,0,0,.5);
}
<div class="calculator">
<div class="name">
<h5>Matthew Industries INC</h5>
</div>
<div class="output">
<div class="previous"></div>
<div class="current"></div>
</div>
<div class="keyboardparent">
<div class="keyboard">
<div class="top">
<button class="clearall">C</button>
<button class="cancel"><img src="delete.svg" class="delete" width="23px" alt=""></button>
<button class="color">%</button>
</div>
<div class="rest">
<button>7</button>
<button>8</button>
<button>9</button>
<button class="color">/</button>
<button>4</button>
<button>5</button>
<button>6</button>
<button class="color">x</button>
<button>1</button>
<button>2</button>
<button>3</button>
<button class="color">-</button>
<button class="color">.</button>
<button>0</button>
<button class="color equal">=</button>
<button class="color">+</button>
</div>
</div>
</div>
</div>
height of .calculator the unit vh to % that is
change this
.calculator{
height: 80vh;
}
to
.calculator{
height: 80%;
}
like this height: 50px; to .output instead of height:25%
Also added a margin-bottom to .keyboardparent
.keyboardparent { margin-bottom: 5.5%;} // you already given margin-top: 5.5%; to output
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Montserrat', sans-serif;
}
body {
background: linear-gradient(90deg, rgba(0,244,147,.7), rgba(30,144,255,.7));
}
.calculator {
border: 1px solid rgb(0,0,0,.3);
width: 80vw;
height: 80%;
margin: auto;
position: relative;
top: 50vh;
transform: translateY(-50%);
border-radius: 10px;
background: rgb(225,225,225);
box-shadow: 0 0 10px rgb(0,0,0,.7), -5px -5px 10px rgb(0,0,0,.3) inset, 5px 5px 5px rgb(255,255,255) inset;
}
.name {
width: 100%;
height: 3%;
position: absolute;
top:10px;
}
h5 {
display: flex;
justify-content: center;
align-items: center;
font-size: .8em;
color: rgb(0,0,0,.5);
position: relative;
top: 50%;
transform: translateY(-50%);
}
.output {
width: 90%;
height: 50px;
margin: auto;
margin-top: 5.5%;
background: white;
box-shadow: 0 0 5px rgb(0,0,0,.7) inset ;
border-radius: 3px;
}
.previous {
width: 100%;
height: 40%;
border-bottom: .5px solid rgb(0,0,0,.5);
}
.current {
width: 100%;
height: 60%;
}
.keyboardparent {
width: 90%;
height: 75%;
margin: auto;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
border:3px solid red;
margin-bottom: 5.5%;
}
.keyboard {
width: 100%;
height: 90%;
margin: auto;
border:3px solid black;
}
.top {
display: grid;
grid-template-columns: 2fr 1.5fr 1fr;
grid-gap: .5em;
-webkit-gap: .5em;
}
.rest {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-gap: .5em;
-webkit-grid-gap: .5em;
margin-top: .5em;
}
button {
cursor: pointer;
font-size: 1.5em;
padding: 10px;
border-radius: 10px;
border: none;
box-shadow: 0 0 3px rgba(0,0,0,.5), -3px -3px 5px rgba(0,0,0,.3) inset, 3px 3px 5px rgba(255,255,255,.8) inset;
outline: none;
background: rgba(250,250,250,.8);
}
.color {
background: rgba(0,200,197,.3);
}
button:active {
transform: scale(.95);
}
<div class="calculator">
<div class="name">
<h5>Matthew Industries INC</h5>
</div>
<div class="output">
<div class="previous"></div>
<div class="current"></div>
</div>
<div class="keyboardparent">
<div class="keyboard">
<div class="top">
<button class="colorc">C</button>
<button class="color"><img src="delete.svg" class="delete" width="20px" alt=""></button>
<button class="color">%</button>
</div>
<div class="rest">
<button>7</button>
<button>8</button>
<button>9</button>
<button class="color">/</button>
<button>4</button>
<button>5</button>
<button>6</button>
<button class="color">x</button>
<button>1</button>
<button>2</button>
<button>3</button>
<button class="color">-</button>
<button class="color">.</button>
<button>0</button>
<button class="color">=</button>
<button class="color">+</button>
</div>
</div>
</div>
</div>
Related
When I resize the page the searchbox starts resizing after the padding of the parent if zero. I want to resize the div with class-"searchbox", with resizing the page not after the parent's padding is off. Here is the code I'll be glad if you correct me anywhere.
.site-wrapper {
max-width: 86.5rem;
min-height: 28rem;
padding: 0 4.3rem;
margin: 0 auto;
overflow: hidden;
}
.navbar {
display: flex;
justify-content: end;
padding-top: 2.7rem;
}
#hamburger-button {
position: relative;
width: 32px;
height: 32px;
border-radius: 4px;
cursor: pointer;
}
#hamburger-button:hover {
background-color: #0000001f;
}
#hamburger {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: none;
background-color: transparent;
background-image: url(/assets/menuicon.svg);
background-repeat: no-repeat;
background-size: contain;
padding: 9.2px;
margin: 0 auto;
cursor: pointer;
}
.header-content {
margin: 0 auto;
}
.header-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.header-content-logo {
margin-top: 5rem;
margin-bottom: 2.3rem;
}
.header-content-logo svg {
width: 12.6rem;
}
.searchbox {
display: flex;
align-items: center;
border-radius: 6px;
width: 100%;
max-width: 38.7rem;
height: 2.7rem;
background-color: #fff;
box-shadow: 0px 2px 6px 1px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.searchbox:hover {
box-shadow: 0px 6px 20px 6px rgba(0, 0, 0, 0.1);
}
.searchbox input {
width: 92%;
border: none;
background-color: transparent;
font-size: 11.8pt;
font-family: inherit;
padding-left: 1rem;
}
.searchbox input:focus {
outline: none;
}
<div class="site-wrapper">
<div class="navbar">
<div id="hamburger-button">
<button id="hamburger"></button>
</div>
</div>
<div class="header-content">
<div class="header-content-logo">
<svg>
</div>
<div class="searchbox">
<input type="text" placeholder="Search without being tracked">
</div>
</div>
</div>
I have tried putting margin and even making another div before it and putting padding but seems that it didn't make it work. I am out of options.
I am creating a rank system tier using flexbox , and I want to add an image(thumbnail) above the bars, but however I dont have any idea how to do so . the red circle means that an image will be there a small one maybe 50x50 px or less , but how can I add an image above ?
.post-content-wrapper {
padding: 20px;
margin-bottom: 2em;
position: relative;
max-width: 900px;
margin-left: auto;
margin-right: auto;
background-color: #f7f7f7;
border-radius: 7px;
box-sizing: border-box;
}
.flex7 {
display: flex;
height: 300px;
justify-content: space-between;
align-items: flex-end;
}
.flex {
background-color: #f7f7f7;
border-radius: 3px;
padding: 20px;
}
.flex7-child-1 {
height: 40%;
}
.flex7-child {
width: 14%;
}
.child {
border-radius: 3px;
background-color: #A2CBFA;
border: 1px solid #4390E1;
box-sizing: border-box;
box-shadow: 0 2px 2px rgba(0,90,250,0.05), 0 4px 4px rgba(0,90,250,0.05), 0 8px 8px rgba(0,90,250,0.05), 0 16px 16px rgba(0,90,250,0.05);
}
.flex7-child-2 {
height: 50%;
}
.flex7-child-3 {
height: 60%;
}
.flex7-child-4 {
height: 20%;
}
.flex7-child-5 {
height: 30%;
}
<div class="post-content-wrapper">
<div class="flex flex7">
<div class="child flex7-child flex7-child-1"></div>
<div class="child flex7-child flex7-child-2"></div>
<div class="child flex7-child flex7-child-3"></div>
<div class="child flex7-child flex7-child-4"></div>
<div class="child flex7-child flex7-child-5"></div>
</div>
</div>
You can use pseudo css classes (like :after or :before)
https://www.w3schools.com/css/css_pseudo_classes.asp. This example shows a solution only for the first bar.
.post-content-wrapper {
padding: 20px;
margin-bottom: 2em;
position: relative;
max-width: 900px;
margin-left: auto;
margin-right: auto;
background-color: #f7f7f7;
border-radius: 7px;
box-sizing: border-box;
}
.flex7 {
display: flex;
height: 300px;
justify-content: space-between;
align-items: flex-end;
}
.flex {
background-color: #f7f7f7;
border-radius: 3px;
padding: 20px;
}
.flex7-child-1 {
height: 40%;
position: relative;
}
.flex7-child-1:before {
content: '';
position: absolute;
background-image: url('https://via.placeholder.com/50.png');
background-repeat: none;
background-position: center center;
background-size: contain;
top: -60px;
left: 0;
right: 0;
margin: 0 auto;
display: block;
width: 50px;
height: 50px;
}
.flex7-child {
width: 14%;
}
.child {
border-radius: 3px;
background-color: #A2CBFA;
border: 1px solid #4390E1;
box-sizing: border-box;
box-shadow: 0 2px 2px rgba(0,90,250,0.05), 0 4px 4px rgba(0,90,250,0.05), 0 8px 8px rgba(0,90,250,0.05), 0 16px 16px rgba(0,90,250,0.05);
}
.flex7-child-2 {
height: 50%;
}
.flex7-child-3 {
height: 60%;
}
.flex7-child-4 {
height: 20%;
}
.flex7-child-5 {
height: 30%;
}
<div class="post-content-wrapper">
<div class="flex flex7">
<div class="child flex7-child flex7-child-1"></div>
<div class="child flex7-child flex7-child-2"></div>
<div class="child flex7-child flex7-child-3"></div>
<div class="child flex7-child flex7-child-4"></div>
<div class="child flex7-child flex7-child-5"></div>
</div>
</div>
I have a horizontal bar that has 4 items or maybe more. What I am trying to do is that when the browser is resized each item of the horizontal bar with its respective element, however, I am using twitter-bootstrap 4, but it doesn't seem to work either by default
.post-content-wrapper {
padding: 20px;
margin-bottom: 2em;
position: relative;
max-width: 900px;
margin-left: auto;
margin-right: auto;
background-color: #f7f7f7;
border-radius: 7px;
box-sizing: border-box;
}
.flex7 {
display: flex;
height: 300px;
justify-content: space-between;
align-items: flex-end;
}
.flex {
background-color: #f7f7f7;
border-radius: 3px;
padding: 20px;
}
.flex7-child-1 {
height: 40%;
position: relative;
}
.flex7-child-1:before {
content: '';
position: absolute;
background-image: url('https://via.placeholder.com/50.png');
background-repeat: none;
background-position: center center;
background-size: contain;
top: -60px;
left: 0;
right: 0;
margin: 0 auto;
display: block;
width: 50px;
height: 50px;
}
.flex7-child-2:before {
content: '';
position: absolute;
background-image: url(https://via.placeholder.com/50.png);
background-repeat: none;
background-position: center center;
background-size: contain;
top: 88px;
left: -170px;
right: 0;
margin: 24px auto;
display: block;
width: 50px;
height: 50px;
}
.flex7-child-3:before {
content: '';
position: absolute;
background-image: url(https://via.placeholder.com/50.png);
background-repeat: none;
background-position: center center;
background-size: contain;
top: 85px;
left: 0;
right: 0;
margin: 0 auto;
display: block;
width: 50px;
height: 50px;
}
.flex7-child-4:before {
content: '';
position: absolute;
background-image: url(https://via.placeholder.com/50.png);
background-repeat: none;
background-position: center center;
background-size: contain;
top: 85px;
left: 170px;
right: 0;
margin: 106px auto;
display: block;
width: 50px;
height: 50px;
}
.flex7-child-5:before {
content: '';
position: absolute;
background-image: url(https://via.placeholder.com/50.png);
background-repeat: none;
background-position: center center;
background-size: contain;
top: 58px;
left: 166px;
right: -174px;
margin: 106px auto;
display: block;
width: 50px;
height: 50px;
}
.flex7-child {
width: 14%;
}
.child {
border-radius: 3px;
background-color: #A2CBFA;
border: 1px solid #4390E1;
box-sizing: border-box;
box-shadow: 0 2px 2px rgba(0,90,250,0.05), 0 4px 4px rgba(0,90,250,0.05), 0 8px 8px rgba(0,90,250,0.05), 0 16px 16px rgba(0,90,250,0.05);
}
.flex7-child-2 {
height: 50%;
}
.flex7-child-3 {
height: 60%;
}
.flex7-child-4 {
height: 20%;
}
.flex7-child-5 {
height: 30%;
}
<div class="post-content-wrapper">
<div class="flex flex7">
<div class="child flex7-child flex7-child-1"></div>
<div class="child flex7-child flex7-child-2"></div>
<div class="child flex7-child flex7-child-3"></div>
<div class="child flex7-child flex7-child-4"></div>
<div class="child flex7-child flex7-child-5"></div>
</div>
</div>
before toggle
after toggle, I am expecting to have the same position even when I resize the layout without breaking the elements
Here's a better way to achieve responsive consistent styles for your horizontal bars. Note that individual styles for each .flex7-child-#:before has been removed, and all .flex7-child elements now use flexbox.
.post-content-wrapper {
padding: 20px;
margin-bottom: 2em;
position: relative;
max-width: 900px;
margin-left: auto;
margin-right: auto;
background-color: #f7f7f7;
border-radius: 7px;
box-sizing: border-box;
}
.flex7 {
display: flex;
height: 300px;
justify-content: space-between;
align-items: flex-end;
}
.flex {
background-color: #f7f7f7;
border-radius: 3px;
padding: 20px;
}
/* Pay attention to below */
.flex7-child {
display: flex;
flex-direction: row;
justify-content: center;
}
.flex7-child:before {
content: '';
position: relative;
background-image: url('https://via.placeholder.com/50.png');
background-repeat: none;
background-position: center center;
top: -70px;
background-size: contain;
display: block;
width: 50px;
height: 50px;
}
/* Pay attention to above */
.flex7-child {
width: 14%;
}
.child {
border-radius: 3px;
background-color: #A2CBFA;
border: 1px solid #4390E1;
box-sizing: border-box;
box-shadow: 0 2px 2px rgba(0,90,250,0.05), 0 4px 4px rgba(0,90,250,0.05), 0 8px 8px rgba(0,90,250,0.05), 0 16px 16px rgba(0,90,250,0.05);
}
.flex7-child-1 {
height: 40%;
}
.flex7-child-2 {
height: 50%;
}
.flex7-child-3 {
height: 60%;
}
.flex7-child-4 {
height: 20%;
}
.flex7-child-5 {
height: 30%;
}
This isn't an exact example, but I would wrap your thumbnails and bars together something like this:
#container{
margin: auto;
width: 800px;
height: 400px;
border: 3px solid gainsboro;
border-radius: 5px;
display: flex;
justify-content: space-around;
}
.flex-item{
height: 100%;
display: flex;
flex-direction: column-reverse;
}
.flex-item > .bar{
border-radius: 5px;
width: 80px;
background-color: mediumpurple;
border: 1px solid blue;
margin-top: 10px;
}
.flex-item:after{
display: block;
content: '';
height: 80px;
width: 80px;
background-image: url("https://via.placeholder.com/80.png")
}
<div id="container">
<div class="flex-item">
<div class="bar" style="height:40%"></div>
</div>
<div class="flex-item">
<div class="bar" style="height:20%"></div>
</div>
<div class="flex-item">
<div class="bar" style="height:60%"></div>
</div>
<div class="flex-item">
<div class="bar" style="height:50%"></div>
</div>
<div class="flex-item">
<div class="bar" style="height:70%"></div>
</div>
</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 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;
}