March 2017
CSS - ONLINE TOOL - How to Center in CSS
by 3 othersCentering in CSS is a pain in the ass. There seems to be a gazillion ways to do it, depending on a variety of factors. This consolidates them and gives you the code you need for each situation.
Select the type of content you want to center in a parent div and the size of the parent.
October 2015
CSS - html - Horizontally center a div in a div - Stack Overflow
Centering a div of unknown height and width
Horizontally and vertically. Works with reasonably modern browsers (FF, Safari/Webkit, Chrome, IE10, Opera, etc.) ____
.content {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
1
(2 marks)