Results 1 to 14 of 14
-
09-21-2004, 05:40 PM #1rogue element
- Join Date
- Jun 2004
- Location
- Northwest Colorado
- Posts
- 4,636
How To Center Vertically with CSS
Unfrozen Caveman Webmaster here with a tip!
When I designed with table-based layout, I designed many layouts with blocks of text vertically centered in a table cell. Piece of cake! Unfortunately, css doesn't seem to provide an easy alternative, although I'm very new to table-free css layout. I have come across two methods (hacks, whatever).
To vertically center a single line, set its line-height to the height of the element you are centering it in.
For blocks of content, today I stumbled across the following solution, which is so elegant and well-presented I thought I'd share it here:
www.wpdfd.com/editorial/thebox/deadcentre4.html
-
11-18-2004, 06:29 PM #2New Member
- Join Date
- Nov 2004
- Location
- Detroit
- Posts
- 3
thats a good hack, thanks for sharing
-
01-23-2005, 06:19 AM #3Disabled
- Join Date
- Jun 2003
- Posts
- 4
Thanks for sharing. But I don't really understand
-
01-23-2005, 09:09 AM #4learning is in the doing
- Join Date
- Sep 2000
- Location
- Alberta, Canada
- Posts
- 3,146
The caring is in the sharing. The learning is in the doing.
• PotentProducts.com - for all your Hosting needs
• Helping people Host, Create and Maintain their Web Site
• ServerAdmin Services also available
-
01-29-2005, 03:44 AM #5Web Hosting Master
- Join Date
- Jun 2004
- Location
- Bay Area -USA
- Posts
- 1,740
Thanks! I've been looking for something like this!
<<< Please see Forum Guidelines for signature setup. >>>
-
02-01-2005, 09:03 PM #6Newbie
- Join Date
- Feb 2005
- Posts
- 7
Thanks for sharing! I've always wondered how to do this
-
02-05-2005, 07:47 AM #7WHT Addict
- Join Date
- Dec 2004
- Location
- North Shore
- Posts
- 100
Nice tip. Thanks for sharing
-
02-07-2005, 03:46 AM #8Web Hosting Master
- Join Date
- Dec 2003
- Location
- ./Southest Missouri
- Posts
- 602
I bet I've gone through 4 can's of Mt. Dew messing with that, trying to get it to work before coming across this article... now I'm too wired to sleep... might as well go do some more work! Thanks.
-
02-22-2005, 08:59 AM #9Temporarily Suspended
- Join Date
- Jan 2005
- Location
- Derby, UK
- Posts
- 16
Cheers dude. I use this on my domain name registration 'please wait' page.
-
02-25-2005, 07:37 PM #10Disabled
- Join Date
- Feb 2005
- Posts
- 18
Nice one
Jan
-
03-24-2005, 12:38 PM #11Web Hosting Master
- Join Date
- Mar 2004
- Posts
- 1,016
Good hack. Thanks BigBison!
-
04-15-2005, 10:07 PM #12Newbie
- Join Date
- Apr 2005
- Posts
- 6
yeah thanks for sharing
-
12-05-2005, 05:55 PM #13Newbie
- Join Date
- Dec 2005
- Posts
- 11
Wow nice hack, I've been looking for something like this for a loong time. thnx a bunch
-
12-24-2005, 12:20 AM #14Disabled
- Join Date
- Dec 2005
- Location
- New York City
- Posts
- 6
pretty cool
i used to just have like a bottom or top margin until its centered