5 replies [Last post]
Yuhu
Offline
newbie
Last seen: 15 years 12 weeks ago
Timezone: GMT-1
Joined: 2004-09-21
Posts: 1
Points: 0

Hi,

http://www.jakpsatweb.cz/css/css-vertical-center-solution.html

please look how to make vertical center of box with unknown height.

Yuhu

co2
co2's picture
Offline
Leader
UK
Last seen: 11 years 34 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

Vertical Centering in CSS Solution

Hi Yuhu

Haven't had much chance to look into/have a go of your code yet, but looks decent.

I'd suggest posting this in the Knowledge Base forum and perhaps the Common Questions forum on here, as so you can get more exposure. Don't think many people look at the Geek News forum!

Smile

The next sentence is true. The previous sentence is false. Discuss...

RobinAnn
RobinAnn's picture
Offline
Regular
Boston, USA
Last seen: 12 years 13 weeks ago
Boston, USA
Timezone: GMT+5
Joined: 2005-04-02
Posts: 30
Points: 0

Vertical Centering in CSS Solution

I liked your code Yuhu so much I expanded it Laughing out loud check out example 1 and example 2

My Home Page :: www.robin-ann.com ::
My Photo Page :: www.robinannpeters.com ::
My End Spam Page :: www.stopspam-smelltheroses.com ::

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 19 hours 16 min ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9745
Points: 3824

Vertical Centering in CSS Solution

That (without the hacks) is exactly how it could be done were a certain browser a bit more conformant. Due to the hacks and the non-semantic markup, this method would likely create maintenance issues. As seldom as this would be used, I doubt I would remember why I did what, and if someone else were to be the maintainer, would my comments be enough?

I think a single celled table is the more appropriate choice. There are no browser shortcomings to overcome and coders would fully grok the markup. I'm not a fan of the AP centering method due to a number of gotchas, though not likely a problem here.

For practical reasons, these are not as glamorous, but, IMO, are the better methods;

http://garyblue.port5.com/webdev/vcenter.html

http://garyblue.port5.com/webdev/vcenter2.html

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Anonymous
Anonymous's picture
Guru

Vertical Centering in CSS Solution

RobinAnn wrote:
I liked your code Yuhu so much I expanded it Laughing out loud check out example 1 and example 2
Both center vertically but neither center horizontally in Safari.

RobinAnn
RobinAnn's picture
Offline
Regular
Boston, USA
Last seen: 12 years 13 weeks ago
Boston, USA
Timezone: GMT+5
Joined: 2005-04-02
Posts: 30
Points: 0

Vertical Centering in CSS Solution

Thank you Gary and Triumph; I wonder why I was working on that late last night. I'm glad you pointed ot those shortcomings before I tried to use it anywhere "out there" Brrrrr! Wink

My Home Page :: www.robin-ann.com ::
My Photo Page :: www.robinannpeters.com ::
My End Spam Page :: www.stopspam-smelltheroses.com ::