fikotek napísal:Weroro, da se to udelat i takhle
Kód: Vybrať všetko
.Center-Container {
position: relative;
}
.Absolute-Center {
width: 50%;
height: 50%;
overflow: auto;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
overflow by mal byt skor visible, nie? a IE7 s tym bude mat aj tak problem
ja na tieto veci pouzivam tento tabulkovy pattern uz dlhe roky, nemusis sa ani starat o rozmery toho co chces vycentrovat a zlozito tam davat minusove marginy, jednoducho to vycentruje vsetko. slape to snad na vsetkom (od IE 5.5). ak mi ale nezalezi na starych IEckach, co dnes uz vobec nie, existuje milion inteligentnejsich rieseni.
Kód: Vybrať všetko
html,body{height:100%;overflow:hidden;padding:0;margin:0;}
.table_wrap{height: 100%;display: table;width: 100%;#position: relative}
.cell_wrap{display: table-cell;vertical-align: middle;#position:absolute;#top:50%;}
.container{position:relative;#position:relative;#top:-50%;width:1200px;height:500px;margin:0 auto;background:red;}
<body>
<div class="table_wrap">
<div class="cell_wrap">
<div class="container">
dmasdasnuidnasid
</div>
</div>
</div>
</body>