Re_Boot Posted January 13, 2011 Report Share Posted January 13, 2011 (edited) Sveiki, cenšos sarakstīt kodu, bet nu kā nesanāk, tā nesanāk. Gribu šos <div'us> vertikāli nocentrēt, esmu izmēģinājies n-tos variantus un nu lūdzu palīdzību šeit. Height ir automātisks, tapēc nevaru ar position:absolute; pats visu noregulēt. <div id="ingame-content"> <div style="vertical-align:middle;"> <div id="ingame-text" style="width:23%;">'.date("Y-m-d, H:i A", $row['time']).'</div> <div id="ingame-text" style="width:auto;border-right:1px solid #008;"></div> <div id="ingame-text" style="width:21%;"><b><a href="?info='.$row['id_user'].'">'.$row['username'].'</a> says: </b></div> <div id="ingame-text" style="width:55%;float:right;">'.$row['text'].'</div> </div></div><div class="clear"></div> CSS: #ingame-content { margin:auto; padding: auto; clear: both; color: #FFF; background: #0059a9; border-top: 1px solid #000; border-color: #008; width: 80%; height:auto; font-size:11px; font-weight:inherit; text-align:center; position:relative; overflow:hidden; } #ingame-text { float:left; margin:auto; padding:auto; border:none; width: inherit; height: auto; text-align:center; background:inherit; vertical-align:middle; white-space: pre-wrap; /* CSS3 */ white-space: -moz-pre-wrap; /* Firefox */ white-space: -pre-wrap; /* Opera <7 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* IE */ display:inline; overflow:hidden; } Edited January 13, 2011 by Re_Boot Quote Link to comment Share on other sites More sharing options...
labaiss Posted January 13, 2011 Report Share Posted January 13, 2011 ja pareizi sapratu - liec vnk margin'us ar procentiem - nu kjipa margin top 50% un bla bla Quote Link to comment Share on other sites More sharing options...
briedis Posted January 13, 2011 Report Share Posted January 13, 2011 Nav universāla risinājuma, lai vertikāli centrētos uz visiem pārlūkiem ar mainīgu augstumu. Domāju, ka iekš google atradīsi gana daudz piemēru... Quote Link to comment Share on other sites More sharing options...
labaiss Posted January 13, 2011 Report Share Posted January 13, 2011 (edited) + maybe kaut kas ar Jquery http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ http://stackoverflow.com/questions/965684/vertical-align-div-within-a-div-using-jquery Edited January 13, 2011 by labaiss Quote Link to comment Share on other sites More sharing options...
Re_Boot Posted January 13, 2011 Author Report Share Posted January 13, 2011 Nav universāla risinājuma, lai vertikāli centrētos uz visiem pārlūkiem ar mainīgu augstumu. Domāju, ka iekš google atradīsi gana daudz piemēru... Nezinu, man nav strādājis nedz margin:auto; nedz top:50%... :( Quote Link to comment Share on other sites More sharing options...
labaiss Posted January 13, 2011 Report Share Posted January 13, 2011 margin-top: 20%; piem., Quote Link to comment Share on other sites More sharing options...
Re_Boot Posted January 13, 2011 Author Report Share Posted January 13, 2011 margin-top: 20%; piem., Šis man derētu, ja nebūtu height:auto; Quote Link to comment Share on other sites More sharing options...
labaiss Posted January 13, 2011 Report Share Posted January 13, 2011 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title><!-- Insert your title here --></title> <style type="text/css"> #cube { height: 400px; width: 400px; margin: 0 auto; } #tik { height: auto; width: 400px; padding-top: 50%; padding-bottom: 50%; } </style> </head> <body> <div id="cube"> <div id="tik">sdfgsdfg</div> </div> </body> </html> man der, ja tev nē - izmanto Jquery vai ko citu Quote Link to comment Share on other sites More sharing options...
Re_Boot Posted January 13, 2011 Author Report Share Posted January 13, 2011 + maybe kaut kas ar Jquery http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ http://stackoverflow.com/questions/965684/vertical-align-div-within-a-div-using-jquery Liels paldies! Risinājums rokā: JQuery Valign nostrādāja tieši takā vajadzīgs. Quote Link to comment Share on other sites More sharing options...
Evi Posted January 14, 2011 Report Share Posted January 14, 2011 http://www.jakpsatweb.cz/css/priklady/vertical-align-final-solution-en.html !!! 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.