-5

I have made a really simple calculator, but it being on the top right of the screen makes it look weird. Vertical-align does not work and text-align only works for the text box. How do i make all the buttons centered in the screen???

I put all of the buttons and stuff inside a div called main. How do i center that div vertically and horizontally?

I could manually position it by giving some px values to the left and top but it would not work different screens. I want to make it in a way that it remains centered in a huge variety of screens.

Asef Dian
  • 27
  • 4

2 Answers2

0

You can easily do this with flex-box features.
try this:

display: flex;
align-items: center;
justify-content: center;
-1

U can do it by flex

display:flex;
align-items:center;
Justify-content:center;

Or

display:inline-block;
margin: auto;

It will do.