I'm trying to use CSS transform: scale(1.5); within a flex container. I need the hidden content to be displayed above and centered to the original text, so to do this I am using flex-direction: column; which works.
The issue is when the transform executes, the sibling html element grows too. (You can see the behavior within the code snippet)
I'm sure I'm missing something simple but I've tried several solutions can't figure out why this is happening. Any help is greatly appreciated.
$(document).ready(function() {
$('[data-action="clickable"]').mousedown(function(item) {
$(item.currentTarget).addClass('flex-item-blowout');
$(item.currentTarget).find('.hidden').addClass('displayed');
$(item.currentTarget).find('.hidden').removeClass('hidden');
});
$('[data-action="clickable"]').mouseup(function(item) {
$(item.currentTarget).removeClass('flex-item-blowout');
$(item.currentTarget).find('.displayed').addClass('hidden');
$(item.currentTarget).find('.displayed').removeClass('displayed');
});
$('[data-action="clickable"]').mouseleave(function(item) {
$(item.currentTarget).removeClass('flex-item-blowout');
$(item.currentTarget).find('.displayed').addClass('hidden');
$(item.currentTarget).find('.displayed').removeClass('displayed');
});
});
.flex-container {
padding: 0;
margin: 0;
list-style: none;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row;
line-height: 30px;
}
.flex-item {
background: burlywood;
color: white;
margin: 3px;
font-weight: bold;
font-size: 1.5em;
min-width: 20%;
max-width: 20%;
display: flex;
justify-content: center;
flex-direction: column;
text-align: center;
min-height: 50px;
user-select: none;
}
.flex-item-blowout {
transform: scale(1.5);
background-color: coral;
}
.hidden {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="flex-container">
<div class="flex-item" data-action="clickable">
<span class="hidden">2</span><span>1 + 1</span>
</div>
<div class="flex-item" data-action="clickable">
<span class="hidden">3</span><span>1 + 2</span>
</div>
</div>
Just add align-items: flex-start to the .flex-container, which will prevent the default behavior of the value stretch.
$(document).ready(function() {
$('[data-action="clickable"]').mousedown(function(item) {
$(item.currentTarget).addClass('flex-item-blowout');
$(item.currentTarget).find('.hidden').addClass('displayed');
$(item.currentTarget).find('.hidden').removeClass('hidden');
});
$('[data-action="clickable"]').mouseup(function(item) {
$(item.currentTarget).removeClass('flex-item-blowout');
$(item.currentTarget).find('.displayed').addClass('hidden');
$(item.currentTarget).find('.displayed').removeClass('displayed');
});
$('[data-action="clickable"]').mouseleave(function(item) {
$(item.currentTarget).removeClass('flex-item-blowout');
$(item.currentTarget).find('.displayed').addClass('hidden');
$(item.currentTarget).find('.displayed').removeClass('displayed');
});
});
.flex-container {
padding: 0;
margin: 0;
list-style: none;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row;
line-height: 30px;
align-items: flex-start;
}
.flex-item {
background: burlywood;
color: white;
margin: 3px;
font-weight: bold;
font-size: 1.5em;
min-width: 20%;
max-width: 20%;
display: flex;
justify-content: center;
flex-direction: column;
text-align: center;
min-height: 50px;
user-select: none;
}
.flex-item-blowout {
transform: scale(1.5);
background-color: coral;
}
.hidden {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="flex-container">
<div class="flex-item" data-action="clickable">
<span class="hidden">2</span><span>1 + 1</span>
</div>
<div class="flex-item" data-action="clickable">
<span class="hidden">3</span><span>1 + 2</span>
</div>
</div>
Related
I have a JS fiddle here and it's pretty simple what I want to happen but difficult for me to execute it. In the fiddle, you notice there is a red box. I want that red box to be displayed under the text "Join Balance...". I am not sure how to do this.
Can somebody help me?
Fiddle: https://jsfiddle.net/f2h390wc/
HTML and CSS:
/* newsletter section */
#custom_html-5 {
width: 100%;
background-color: #f2f2f2;
padding-bottom: 40px;
padding-top: 20px;
margin-bottom: 70px;
padding-left: 70px !important;
padding-right: 20px !important;
}
.newsletter_inner_section {
display: flex;
}
.newsletter_gif {
width: 200px;
height: auto;
}
.newsletter_left,
.newsletter_center,
.newsletter_right {
display: inline-flex;
}
.newsletter_left {
width: auto;
}
.newsletter_center {
width: 100%;
align-items: center;
}
.newsletter_right {
background: red;
width: 40%;
justify-content: flex-end;
}
.newsletter_text_section {
color: black !important;
font-size: 24px !important;
font-weight: bold;
}
.eVEmvD.eVEmvD.eVEmvD.eVEmvD.eVEmvD.eVEmvD {
width: fit-content !important;
padding: 0 20px;
}
.fGCWnQ.fGCWnQ {
justify-content: flex-end;
}
.kvTDNe.kvTDNe {
display: unset;
}
/* Media Newsletter section only */
#media (max-width:1144px) {
#custom_html-5 {
padding-left: 20px !important;
padding-right: 20px !important;
}
.newsletter_inner_section {
width: 100% !important;
justify-content: center;
display: flex;
}
.newsletter_center,
.newsltter_right {
flex-direction: column !important;
}
}
<!-- newsletter section -->
<div class="newsletter_section">
<div class="newsletter_inner_section">
<div class="newsletter_left">
<img src="https://balancecoffee.co.uk/wp-content/themes/balancecoffeechild/img/newsletternnobkg2.gif" alt="Balance Newsletter" style="padding-right:30px;" class="newsletter_gif">
</div>
<div class="newsletter_center">
<p class="newsletter_text_section">Join Balance and get 20% off your first order</p>
</div>
<div class="newsletter_right">
<div class="newsletter_input_section">
<div class="klaviyo-form-Rrsqsh"></div>
</div>
</div>
</div>
</div>
If you want the text and the red box on the right to form a column, then they both need to be in a flexbox with flex-direction: column;.
I created a sample from scratch because there is a lot of superfluous stuff in your JSFiddle.
.group {
display: flex;
flex-direction: row;
width: 100%;
}
.content-box {
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
padding: 40px;
}
.left {
background-color: blue;
}
.right {
flex-grow: 1;
display: flex;
flex-direction: column;
}
.top-right {
background-color: green;
}
.bottom-right {
background-color: red;
}
<div class='group'>
<div class='left content-box'>
Content
</div>
<div class='right'>
<div class='top-right content-box'>
Content
</div>
<div class='bottom-right content-box'>
Content
</div>
</div>
</div>
https://www.w3schools.com/cssref/css3_pr_flex-direction.asp
display: flex;
flex-direction: column;
I want to place a text inline and between two arrows. at first it seems easy but I can't place everything in their right place:
html, body {
height: 100%;
}
body {
background: #fafafc;
margin: 0;
}
.flex-container {
height: 100%;
padding: 0;
margin: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
}
.grid-container {
width: 50%;
display: grid;
grid-template-columns: 40px auto 40px;
}
.referenceText {
font-family: Arial;
display: inline-block;
font-size: 3vw;
color: #4287f5;
/*outline: 0.1vw dashed red;*/
}
.link {
font-size: 200px;
color: #a7a4bf;
text-decoration: none;
width: 100px;
height: 100px;
outline: 0.1vw dashed orange;
}
.link:hover {
color: #636175;
}
<div class="flex-container">
<div class="grid-container">
<a class="link" href="">‹</a>
<div class="referenceText">This is the reference</div>
<a class="link" href="">›</a>
</div>
</div>
Please note that we want the arrows to be at the edges of the screen and the text at the center...
Make these changes in .grid-container and .link
.grid-container {
width: 80%;
display: grid;
grid-template-columns: 100px auto 100px;
align-items: center;
justify-items: center;
}
.link {
font-size: 200px;
color: #a7a4bf;
text-decoration: none;
width: 100px;
/* height: 100px; remove height*/
outline: 0.1vw dashed orange;
}
check codepen
Add display: flex;, align-items: center; and justify-content: space-between; to .grid-container and change the width to 100%.
So I have an element that looks just like this:
According to the designers plan, I need to put a little "?" just on right of the text (8.00$).
I use flexbox to center my elements. Basically, I nedd the ? to be directly on the right of the number. I don't want this element to push the number to the left. So, the 8 stays centered, the ? goes directly to the right without changing the position of the 8.
I did my own research and all the solutions given were using absolute positionning. I mean, it can work, but if I have bigger numbers, the ? will probably be over the text.
Do you have any suggestion?
Code, I don't know if it will work:
/* weirdly, display:flex and width:100% have a stroke over them in the console */
.compare-row-small-box {
display: flex;
text-align: center;
width: 100%;
line-height: 1;
padding-top: 1rem;
padding-bottom: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.compare-row-box-title {
--text-opacity: 1;
color: #4a5568;
color: rgba(74, 85, 104, var(--text-opacity));
font-size: 12px;
}
.compare-row-box-content {
font-size: 16px;
display: flex;
flex: 1 1;
flex-direction: column;
justify-content: flex-start;
}
<div class="space-y-1 compare-row-small-box">
<p class="compare-row-box-title">Frais mensuels estimés</p>
<div class="compare-row-box-content"><span>8.00 $</span></div>
</div>
Using CSS after with content you can add the ? after the $
.compare-row-small-box {
display: flex;
text-align: center;
width: 100%;
line-height: 1;
padding-top: 1rem;
padding-bottom: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.compare-row-box-title {
--text-opacity: 1;
color: #4a5568;
color: rgba(74, 85, 104, var(--text-opacity));
font-size: 12px;
}
.compare-row-box-content {
font-size: 16px;
display: flex;
flex: 1 1;
flex-direction: column;
justify-content: flex-start;
}
.compare-row-box-content span {
position: relative;
}
.compare-row-box-content span::after{
content: '?';
position: absolute;
}
<div class="space-y-1 compare-row-small-box">
<p class="compare-row-box-title">Frais mensuels estimés</p>
<div class="compare-row-box-content"><span>8.00 $</span></div>
</div>
<div class="space-y-1 compare-row-small-box">
<p class="compare-row-box-title">Frais mensuels estimés</p>
<div class="compare-row-box-content x"><span>1238.00 $</span></div>
</div>
Put the '?' in an :after pseudo-element like this.
/* weirdly, display:flex and width:100% have a stroke over them in the console */
.compare-row-small-box {
display: flex;
text-align: center;
width: 100%;
line-height: 1;
padding-top: 1rem;
padding-bottom: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.compare-row-box-title {
--text-opacity: 1;
color: #4a5568;
color: rgba(74, 85, 104, var(--text-opacity));
font-size: 12px;
}
.compare-row-box-content {
font-size: 16px;
display: flex;
flex: 1 1;
flex-direction: column;
justify-content: flex-start;
}
.compare-row-box-content span::after {
content: '?';
position: absolute;
margin-left: 5px;
}
<div class="space-y-1 compare-row-small-box">
<p class="compare-row-box-title">Frais mensuels estimés</p>
<div class="compare-row-box-content"><span>8.00 $</span></div>
</div>
Use a pseudo-element to add your character and use relative positioning to give it some space.
/* weirdly, display:flex and width:100% have a stroke over them in the console */
.compare-row-small-box {
display: flex;
text-align: center;
width: 100%;
line-height: 1;
padding-top: 1rem;
padding-bottom: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.compare-row-box-title {
--text-opacity: 1;
color: #4a5568;
color: rgba(74, 85, 104, var(--text-opacity));
font-size: 12px;
}
.compare-row-box-content {
font-size: 16px;
display: flex;
flex: 1 1;
flex-direction: column;
justify-content: flex-start;
}
.compare-row-box-content span::after {
content: "?";
color: darkorange;
font-weight: 700;
position: relative;
left: 0.5em;
opacity: 0.5;
transition: opacity 300ms linear;
}
.compare-row-box-content:hover span::after {
opacity: 1;
}
<div class="space-y-1 compare-row-small-box">
<p class="compare-row-box-title">Frais mensuels estimés</p>
<div class="compare-row-box-content"><span>8.00 $</span></div>
</div>
<div class="space-y-1 compare-row-small-box">
<p class="compare-row-box-title">Frais mensuels estimés</p>
<div class="compare-row-box-content"><span>800000.00 $</span></div>
</div>
I have divs that contain each individual arrow (one for the greater than text and another for the less than text). However, when I hover over the less than arrow, it pushes all the other elements to the right a bit. How can I have the hover effect not push any other elements away?
This is my HTML:
<div className="datepicker-wrapper">
<div className="dates">
<div className="arrows prev-month"><</div>
<div className="months">
<div className="start-month">February</div>
<div className="end-month">March</div>
</div>
<div className="days"></div>
<div className="arrows next-month">></div>
</div>
<div className="selected-dates">
<div className="check-in-date">02/13/2020</div>
</div>
</div>
And this is my CSS:
#import 'variables.css';
.datepicker-wrapper {
position: relative;
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: flex-start;
width: 100%;
height: 50px;
background: transparent;
}
.datepicker-wrapper .dates {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
width: 60%;
height: 100%;
}
.datepicker-wrapper .selected-dates {
display: flex;
flex-direction: column;
cursor: default;
width: 40%;
height: 100%;
}
.datepicker-wrapper .dates .arrows .previous-month {
}
.datepicker-wrapper .dates .arrows:hover {
width: 15px;
height: 15px;
background: var(--light-gray);
border-radius: 50%;
cursor: pointer;
}
.datepicker-wrapper .dates .months {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
NOTE
I've tried giving the arrows prev-month div a set width, but that doesn't seem to have any effect.
You give the width and height only on hover.. try to give the styles to the arrows anyway, and on hover only change the background-color
.datepicker-wrapper {
position: relative;
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: flex-start;
width: 100%;
height: 50px;
background: transparent;
}
.datepicker-wrapper .dates {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
width: 60%;
height: 100%;
}
.datepicker-wrapper .selected-dates {
display: flex;
flex-direction: column;
cursor: default;
width: 40%;
height: 100%;
}
.datepicker-wrapper .dates .arrows {
width: 15px;
height: 15px;
border-radius: 50%;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
}
.datepicker-wrapper .dates .arrows:hover {
background: #c1c1c1;
}
.datepicker-wrapper .dates .months {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
<div class="datepicker-wrapper">
<div class="dates">
<div class="arrows prev-month"><</div>
<div class="months">
<div class="start-month">February</div>
<div class="end-month">March</div>
</div>
<div class="days"></div>
<div class="arrows next-month">></div>
</div>
<div class="selected-dates">
<div class="check-in-date">02/13/2020</div>
</div>
</div>
Setting the styles on :hover impacts the CSS box model for the .arrows element:
All four of those impact the overall space an element takes.
I want to create a layer from windows 10 calculator and i have some problem in height and width in it.
Any help would be appreciated.
Problems:
when i pull up the top of the result or increase the height of the browseer the calculator go up and a large space appear in the bottom of the calculator and i don't know why is that.
when i decrease the width of the window instead of decrease the width of buttons calculator go right and some buttons won't display.
when i decrease the height of window it won't stop any where but i want to stop it in 500 px height;
This is my code.
html:
<!DOCTYPE html>
<html>
<head>
<link href="./calculator.css" rel="stylesheet" type="text/css">
<title>Windows10 Calculator</title>
<script id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax#3/es5/tex-mml-chtml.js">
</script>
</head>
<body>
<div class="container">
<div class="calculator-container">
<div class="top-navbar">
<p id="calculator">
Calculator
</p>
<div class="close-bar">
<a id="minimize">-</a>
<a id="maximize">🗆</a>
<a id="close">x</a>
</div>
</div>
<div class="calculator-screen">
<div class="top-screen">
<a id="calculator-menu">≡</a>
<p id="standard">
Standard
</p>
</div>
<div class="result"><span id="result">4</span></div>
<div class="m-row">
<a id="MC">MC</a>
<a id="MR">MR</a>
<a id="Mplus">M+</a>
<a id="Mminus">M-</a>
<a id="MS">MS</a>
</div>
</div>
<hr />
<div class="functions">
<div class="row">
<a class="hide-in-big blue">%</a>
<a class="hide-in-big blue">√</a>
<a class="lucida-font hide-in-big blue"><p>
x<sup>2</sup>
</p></a>
<a class="lucida-font hide-in-big blue"><p><sup>1</sup>∕<sub>x</sub></p></a>
</div>
<div class="row">
<a class="show-in-big blue">%</a>
<a class="cs blue">CE</a>
<a class="cs blue">C</a>
<a class="blue"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABDklEQVRYR+2W4Q3CIBSErxu4iY6gm+hmbqIj6CZuUHNJMeQFeAelaUzoT8LjPo570Ak7f9PO+hgAw4G/cuAA4AHg1KFzfhtXHegpTv4qgFj8DeAM4NPowrzUyQA9xaldBaCIc451IzUWDJMBFPE7gCOASwQR6l4AboljkgAUcc55LgAUIwS/0CW5rLgAinjYmIXgOFu0FNQiQI14CoJjXpe4ANZWr93s/RCOI1cnHYEKYR2jAwxlCcIF4CKpgKVazQaOtR68BKBCsA0ZuvhmDPB04drahrmUx/0ez9nkIqqBqHkW5COIF1UyoUI0AdhMqGKlefJrmHNiLUQTwFrRZL36R7SJOBcdAMOB3R34AqM1YCEu+sgCAAAAAElFTkSuQmCC" /></a>
<a class="hover-blue blue">\[\div\]</a>
</div>
</div>
<div class="numpad">
<div class="row">
<a class="lucida-font show-in-big blue">√</a>
<a class="number">7</a>
<a class="number">8</a>
<a class="number">9</a>
<a class="hover-blue blue">×</a>
</div>
<div class="row">
<a class="lucida-font show-in-big blue"><p>
x<sup>2</sup>
</p>
<a class="number">4</a>
<a class="number">5</a>
<a class="number">6</a>
<a class="hover-blue blue">-</a>
</div>
<div class="row">
<a class="lucida-font show-in-big blue"><p>
x<sup>3</sup>
</p></a>
<a class="number">1</a>
<a class="number">2</a>
<a class="number">3</a>
<a class="hover-blue blue">+</a>
</div>
<div class="row">
<a class="lucida-font show-in-big blue"><p><sup>1</sup>∕<sub>x</sub></p></a>
<a class="blue">±</a>
<a class="number">0</a>
<a class="blue">∙</a>
<a class="hover-blue blue">=</a>
</div>
</div>
</div>
<div class="history-memory">
<div>
<div class="hidden-close-bar">
<a id="minimize">ー</a>
<a id="maximize">🗆</a>
<a id="close">྾</a>
</div>
<div class="history-memory-bar">
<a id="history">History</a>
<a id="memory">Memory</a>
</div>
</div>
<div class="history-memory-screen">
<span class="grey"> 2×2=</span>
<span class="black">4</span>
<span class="grey">9999+1=</span>
<span class="black">10000</span>
</div>
</div>
</div>
</body>
CSS:
#font-face{
src:
url("//db.onlinewebfonts.com/t/efbd8f0d869bf61fbe0f139a1602cda8.woff2");
font-family:"lucida calligraphy";
}
body{
min-width: 500px;
width: auto !important;
margin: 0 !important;
overflow: hidden;
font-family: Segoe UI;
}
.close-bar, .hidden-close-bar{
margin-right: 10px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.container{
min-width: 800px;
min-height: 800px;
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
overflow-y: hidden;
background-color: #E6E6E6;
}
.calculator-container{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between !important;
}
.top-navbar{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.top-navbar p {
margin-left: 10px;
}
.top-screen a{
font-size: 2em;
display: flex;
justify-content: center;
align-items: center;
}
.top-screen p{
display: flex;
align-items: center;
justify-content: center;
}
.calculator-screen{
display: flex;
flex-direction: column;
}
.top-screen{
display: flex;
flex-direction: row;
}
.top-screen * {
margin: 1%;
font-size: 2em;
}
.result{
height: 15vh;
display: flex;
justify-content: flex-end;
font-size: 4em;
font-family: Segoe UI;
font-weight: bold;
}
.row{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: bottom
}
.cs{
font-size: 1.5em !important;
}
.m-row{
display: flex;
flex-direction: row;
justify-content: start;
align-items: center;
}
.m-row a{
margin-left: 7%;
cursor: pointer;
}
#standard{
font-size: 1.5em;
margin-left: 3%;
}
.row a {
width: 25%;
height: 10%;
display: flex;
justify-content: center;
align-items: center;
height: 10vh;
margin: 1px;
cursor: pointer;
font-size: 2em;
}
.row a:hover{
background-color: #B1B2B5;
}
.blue{
background-color: #F0F0F0;
font-weight: 300;
}
.number{
background-color: #FAFAFA;
font-weight: bold;
font-size: 1.5em !important;
}
.history-memory{
display: none;
}
.history-memory a {
cursor: pointer;
font-size: 1.5em;
}
.row .hide-in-big{
display: flex;
justify-content: center;
align-items: center;
}
.row .show-in-big{
display: none;
}
.hidden-close-bar{
display: none;
}
.close-bar {
margin: 1px;
}
#history {
border-bottom: 2px solid #0097A7;
margin-right: 10%;
}
#trash-can {
display: flex;
justify-content: flex-end;
align-items: center;
margin: 10px;
background-color: #aad3ef;
cursor: default;
}
#trash-can img {
width: 15%;
cursor: pointer;
background-color: #aad3ef;
}
.history-memory-screen{
display: flex;
flex-direction: column;
justify-content: flex-start;
margin-top: 10%;
height: 100%;
}
.history-memory-bar{
display: flex;
flex-direction: row;
justify-content: flex-start;
}
.grey{
align-self: flex-end;
color: #616161;
margin: 5px;
margin-right: 5px;
}
.black{
align-self: flex-end;
justify-self: flex-end;
margin: 5px;
margin-right: 5px;
}
.lucida-font{
font-family:"lucida calligraphy" !important;
font-size: 1em !important;
font-weight: bold !important;
}
.hover-blue:hover{
background-color: #1C87DB !important;
color: white;
display: flex;
justify-content: center;
align-items: center;
}
#media screen and (max-width: 800px){
.calculator-container{
width: 100%;
height: 100%
}
.row .show-in-big{
display: none;
}
.row .hide-in-big {
display: flex;
justify-content: center;
align-items: center;
}
}
#media screen and (min-width:800px){
.history-memory{
display: flex;
width: 40%;
flex-direction: column;
justify-content: space-between;
}
.hidden-close-bar{
display: block;
text-align: right;
}
.hidden-close-bar a{
margin: 1px;
}
.close-bar {
display: none;
}
}
#media screen and (min-width: 1000px){
.row .hide-in-big{
display: none;
}
.row .show-in-big {
display: flex;
justify-content: center;
align-items: center;
}
}
and this is the link to jsfiddle of my code
problem number 1: since you use min-height, you should define the height of your paren. In your case it is body so this will solve the 1st problem:
body{
/* other stuff */
height: 100vh; /* or whatever px, em, etc., except % */
}
problem number 2: As I understand, the problem appears with the 'M' buttons, since all others seem to be resized correctly... so if you add max-width to the .m-row a it would prevent overflow. You also could add the font-size in vw as you did for the other buttons, though I wouldn't do this because all the texts become unreadable in a small window.
.m-row a{
margin-left: 7%;
max-width: 13%; /* because you have 5 buttons (each 20%) - 7% of your margin-left*/
}
problem number 3: You could open a new window with specified dimensions with some javascript and control it's size with window.resizeTo. However I think some browsers won't allow this.. So instead I would simply add min-width, min-height add overflow: auto to the parent (in your case the body).
I hope it helps.