I'm trying to make a calculator and am currently working on HTML and CSS. I'm trying to make the calculator larger both vertically and horizontally. I can easily increase the width to fit the container using width: 100% or flex: 1 1 100%; however, whenever I try to increase the height with height: 100%; it goes outside the bounds of the container and the input button becomes huge. I've tried using flex-basis and flex-grow to make it grow vertically as well, but I can't.
<body> <div class="container"> <form> <div class="display"> <input type="text" name="display"> </div> <div class="column1"> <input type="button" value="AC"> <input type="button" value="+/-"> <input type="button" value="%"> <input type="button" value="/"> </div> <div class="column2"> <input type="button" value="7"> <input type="button" value="8"> <input type="button" value="9"> <input type="button" value="*"> </div> <div class="column3"> <input type="button" value="4"> <input type="button" value="5"> <input type="button" value="6"> <input type="button" value="-"> </div> <div class="column4"> <input type="button" value="1"> <input type="button" value="2"> <input type="button" value="3"> <input type="button" value="+"> </div> <div class="column5"> <input type="button" value="0"> <input type="button" value="."> <input type="button" value="="> </div> </form> </div> </body> html { height: 100%; } body { display: flex; justify-content: center; align-items: center; margin: 0; height: 100%; } .container { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; height: 50%; width: 30%; } form { flex: 0 1 100%; } .column1, .column2, .column3, .column4, .column5, .display { display: flex; height: 100%; } .column1 input, .column2 input, .column3 input, .column4 input, .column5 input, .display input { flex: 1 1 100%; }
The following is the specific operation method: