css divide div vertically code example
Example 1: vertically and horizontally center a fixed div
// you dont need to know the divs dimensions and it does not require any container divs
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
Example 2: how to center a div vertically and horizontally
.container{
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: /* Define the width here; */
height: /* Define the height here; */
}
/*You have to define the width and height! */