Jump to content
php.lv forumi

CSS <div> vertical-align


Recommended Posts

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 by Re_Boot
Link to post
Share on other sites

<?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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...