Jump to content


vertical align


4 replies to this topic

#1 Chris.

    Young Padawan

  • Members
  • Pip
  • 129 posts
  • Gender:Male

Posted 12 February 2009 - 02:41 PM

I'm trying to align sometime vertically in a 25px high block of CSS. I tried using the "vertical-align: middle" attribute, but that didn't work, I looked online for a little bit, and found this,

DIV.container {
	min-height: 10em;
	display: table-cell;
	vertical-align: middle }

but that didn't work either. I want my text to be centered vertically in my block, but I can't, for the life of me, figure out how to do it.. Please help

#2 MyFlash13

    Young Padawan

  • Members
  • Pip
  • 209 posts
  • Gender:Male
  • Location:Toronto,Canada

Posted 13 February 2009 - 08:36 AM

See if this helps:

http://www.w3schools...tical-align.asp
http://www.w3schools.com/Css/tryit.asp?fil..._vertical-align

#3 Chris.

    Young Padawan

  • Members
  • Pip
  • 129 posts
  • Gender:Male

Posted 13 February 2009 - 02:48 PM

The vertical align attribute didn't work either... I mean, I got it centered vertically using padding, but there has to be a better way to do it...

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 13 February 2009 - 07:53 PM

:P
http://www.google.co...vertical+center

#5 harry819

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 19 February 2009 - 01:12 AM

use this code
<STYLE type="text/css">
 #container { width: 100%; height: 100%; display: table; }
 #position { display: table-cell; vertical-align: middle; width: 100%; text-align: center; }
 </STYLE>

Edited by harry819, 19 February 2009 - 01:15 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users