html - Can't center animated div with Animate.CSS or other animation libraries -
i'm trying center div in page , animate it, but
transform:translate(-50%, -50%)
will not work @ relying on default
top: 50%; left: 50%
here html code:
<html> <head> <link href="http://www.exaltedweb.com/refs/animate.css" rel="stylesheet" type="text/css"/> <link href="stylesheets/admin2.css" rel="stylesheet" type="text/css"/> </head> <body> <div id="container"> <div class="modal-wrapper" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0; display:block;"> <div class="modal-background" style=""></div> <div class="modal-content animated bouncein"></div> </div> </div> </body>
here css:
#container{ width: 100%; height: 100%; } .modal-wrapper{ position: absolute; width: 100%; height: 100%; } .modal-background{ position: absolute; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); display:block; } .modal-content{ top: 50%; left: 50%; position: absolute; transform: translate(-50%, -50%); width: 100px; height: 100px; background-color: blue; }
i've tried ton of things display: block; , bunch of other methods found online, none of methods have works. appreciated i've been stuck on issue entire day. in advance!
check jsfiddle "jsfiddle.net/solaceinfotech/7sj2ma2m/3/" set html element @ center of page. change height within #container {}
if want set element @ center specific size of block. else set 100% block display @ center of whole page.
it tested in chrome, opera , firefox , working fine these browsers.
Comments
Post a Comment