temat był już poruszany pewnie, ale nigdzie nie mogę znaleźć rozwiązania które by zadziałało.
Mam problem jak wyśrodkować diva w pionie.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" rev="stylesheet" href="main.css"> </head> <body> <div id="all"> <div id="top"> <div id="top_left"> </div> <div id="top_right"> </div> </div> <div id="bottom"> <div id="bottom_left"> </div> <div id="bottom_right"> </div> </div> <div id="img"> <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt=""> </div> </div> </body> </html>
i css
body { background: url(http://www.provider.pl/img/bckg2.png); font-size: 12px; font-family: arial, helvetica, sans-serif; color: #333; background-repeat:repeat-x; text-align: center; vertical-align: middle; } #all{ background-color: #000; width: 400px; height:400px; overflow: hidden; margin-left: auto; margin-right: auto; /*margin-bottom: -200px; margin-top:50%;*/ } #top{ height: 185px; width: 380px; background-color: #000; margin: 10px 10px 10px 10px; } #top_left{ height: 185px; width: 185px; background-color: #0191B8; margin-right: 5px; float: left; } #top_right{ height: 185px; width: 185px; background-color: #D6F40B; margin-left: 5px; float: left; } #bottom{ height: 185px; width: 380px; background-color: #000; margin: 10px 10px 10px 10px; } #bottom_left{ height: 185px; width: 185px; background-color: #00A414; margin-right: 5px; float: left; } #bottom_right{ height: 185px; width: 185px; background-color:#FF0404; margin-left: 5px; float: left; } #img{ position: relative; top: -215px; left: 0px; }
Wszystko mi działa jak chcę tylko nie mogę wyśrodkować całości (div id=all) w pionie.
Parametr vertical-align: middle; nie reaguje, div dosunięty jest w tedy do górnej krawędzi okna.
Ten sam efekt w Firefox, Chrome, IE.
Proszę o pomoc.