ziedinjsh Posted January 4, 2011 Report Share Posted January 4, 2011 Sveiki! Man ir problēma ar tādu lietu: CSS: .top{ background-color:#fff000; width:100%; height:100px; } .center{ border:1px solid #ff0000; width:800px; height:100%; position:absolute; z-index:1; top:0; margin-left:auto; margin-right:auto; } .bottom{ background-color:#fff000; width:100%; height:100px; position:fixed; bottom:0px; } Vajag lai div ar clasi center atrodas pa vidu, bet ja ir: margin-left:auto; margin-right:auto; VAI margin:0 auto; VAI left:50%; right:50%; nevienā no variantiem div ar klasi center nenostājas pa vidu, kapēc tā? kā lai nocentrē? Paldies jau iepriekš! Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted January 4, 2011 Report Share Posted January 4, 2011 absolūti pozicionētus elementus centrē tā: .center { /* <CENTRĒ VERTIKĀLI> */ height:200px; top:50%; margin-top:-100px; /* - (garums / 2) px */ /* </CENTRĒ VERTIKĀLI> */ /* <CENTRĒ HORIZONTĀLI> */ width:200px; left:50%; margin-left:-100px; /* - (platums / 2) px */ /* </CENTRĒ HORIZONTĀLI> */ } Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted January 4, 2011 Author Report Share Posted January 4, 2011 Paldies, palīdzēja! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.