{"id":1201,"date":"2014-06-23T16:59:58","date_gmt":"2014-06-24T02:59:58","guid":{"rendered":"http:\/\/mymonkeydo.com\/?p=1201"},"modified":"2014-06-23T16:59:58","modified_gmt":"2014-06-24T02:59:58","slug":"vertically-center-anything-with-dimensions","status":"publish","type":"post","link":"https:\/\/mymonkeydo.com\/vertically-center-anything-with-dimensions\/","title":{"rendered":"Vertically Center Anything With Dimensions"},"content":{"rendered":"
One way to easily vertically center a div is to set it to be absolute, set the width, height and then the top, bottom, left and right all equal to 0. \u00a0Something like this:<\/p>\n
\n\n.vertically-centered-box {\n\n position:absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width:100px;\n height:100px;\n margin:auto;\n\n}\n\n<\/pre>\n