Click to See Complete Forum and Search --> : Vertical Alignment


Wozza
08-10-2003, 08:59 PM
Do web designers have a higher suicide rate than dentists? Or teenagers? What about teenage web designers (like myself)? This stuff is bad for the brain. =P

Anyway. What I need to do is have a block of text centered on the page, both vertically and horizontally. The horizontal thing isn't a problem, but I can't find a way of doing the vertical, without using a table. The vertical-align property doesn't appear to work at all (and a search of these forums seems to indicate that it isn't supported by all browsers). Also, it seems (although I don't quite understand it) to do something other than what I need, anyway.

I could do this with a div positioned centerally on the page (easy enough, now), and made the correct size to contain the text, but I want to do this many times, with many different-sized blocks of text. So, doing it that way would kinda defeat the purpose of using a style sheet, likesay. Ken?

I could do it with a table, which is also fairly straighforward, but apparently it's Not Cricket to use tables for formatting.

Any help would, as always, be most appreciated.

Cheers-
Wozza

pyro
08-10-2003, 09:56 PM
I'm going to share my point of view....

CSS is meant for layout, so by all means, use it when possible. Unfortunatly, there are certain layout that are hard, if not impossible, to recreate using CSS. A good example would be a three column layout. Very hard with CSS, and when it can be done, it is often dependent on a certain column being the longest column. Also, if your site receives a large number of 4.x browsers, with CSS was not being well supported in them, tables offer a better alternative, as the site will look nearly the same in all browsers. The solution would be to use a hybrid layout. I have done so at my site (http://www.infinitypages.com) due to the three column layout. One thing to note is that just becuase you use a hybrid layout, your site should still use valid code. Don't use depreciated tags such as <font>, <center>, etc... Use CSS -- that's what it's for.

Wozza
08-10-2003, 11:11 PM
Fair enough. Many thanks =)

-Wozza