467,880 Members | 1,086 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,880 developers. It's quick & easy.

Vertically aligning to the middle in a fixed div?

Hi.

I've got a few divs on a page that are positioned as "fixed". I now want
my text to centre itself both horizontally and vertically. "text-align:
center" on the body works for horizontal, but I can't seem to get the
text to move from the top of each div. Any suggestions?

Incidentally, the page layout I'm aiming for is as follows:

..-------------------------------------------.
| .-------.-------.-------. |
| | | | | |
| | TXT | TXT | TXT | |
| | | | | |
| |-------+-------+-------| |
| | | | | |
| | TXT | TXT | TXT | |
| | | | | |
| |-------+-------+-------| |
| | | | | |
| | TXT | TXT | TXT | |
| | | | | |
| |-------+-------+-------| |
| | Extra centered text | |
| '-----------------------' |
'-------------------------------------------'

The outer rectangle is supposed to be the viewport. This is easy with
tables, but I'm currently using fixed divs for the ten rectangles. Is
there a better way to do this?

Thanks,

Iain Hallam.
Jul 20 '05 #1
  • viewed: 2977
Share:
2 Replies
On Mon, 01 Mar 2004 16:41:03 +0000, Iain Hallam wrote:
I now want
my text to centre itself both horizontally and vertically.


http://www.quirksmode.org/css/centering.html
http://www.wpdfd.com/editorial/thebox/deadcentre4.html

--

..

Jul 20 '05 #2
Vigil wrote:
Iain Hallam wrote:
I now want my text to centre itself both horizontally and vertically.

http://www.quirksmode.org/css/centering.html
http://www.wpdfd.com/editorial/thebox/deadcentre4.html


Thanks - that's got it working, although I've had to go back to a table
design. The markup is much smaller and the CSS less twisted with a table
for this site.

- Iain.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by George Ziniewicz | last post: by
27 posts views Thread by FL | last post: by
7 posts views Thread by Scott Teglasi | last post: by
3 posts views Thread by Mark Wiewel | last post: by
reply views Thread by pamelafluente | last post: by
4 posts views Thread by Greg Scharlemann | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.