CMoney
5
Q:

vertically and horizontally center a fixed div

.parent {
  position: relative;
}
.child {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
3
.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! */
2
// 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%);
0
left: 50%;
transform: translateX(-50%);
0
left: 50%;
margin-left: -400px; /* Half of the width */
0

New to Communities?

Join the community