centering vertically

This is a discussion on "centering vertically" within the Web Page Design section. This forum, and the thread "centering vertically are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Apr 12th, 2004, 08:17
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
centering vertically

does anyone know how to place an image, for example, in the exact vertical center of a browser, regardless of whether the browser is resized or not...?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Apr 12th, 2004, 09:20
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
only as a background...
body { background: url(images/myimage.gif) no-repeat 50% 50%; }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Apr 12th, 2004, 10:06
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
alternatively you could place it in a table cell with the parameters valign="middle" ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Apr 12th, 2004, 10:11
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
not x-browser. If you wanted it only to work for IE, then you could have a single-cell <s>ameoba</s> table with width="100%" height="100%".
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Apr 12th, 2004, 11:05
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
i write in XHTML 1.0 Transitional and in XHTML there is no height attribute assigned to a <table> so it does not validate
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Apr 12th, 2004, 18:52
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
Exactly. Stick to the CSS solution.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old Apr 14th, 2004, 08:41
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,184
Blog Entries: 7
Thanks: 27
Thanked 22 Times in 19 Posts
You would think there would be a way to do it by having a container set to 100 percent width and height specifying vertical and horizontal centered alignments..... but NO!!! Crappy support of CSS to implement this.

This actually is rather dissapointing.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old Apr 14th, 2004, 09:42
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
what can you do in CSS to accomplish this though?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
Old Apr 14th, 2004, 11:50
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Again, I'm forced to take the "who cares if it validates as long as all the browsers can see it the same?" route.

The differences between browsers and the limits of the specification are here and sometimes you can't fit both.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #10  
Old Apr 14th, 2004, 13:36
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
ok then.. i just like my code to validate, because im strange like that! and also, if they move from HTML to XHTML and it doesnt validate... it means changing what you've done
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #11  
Old Apr 14th, 2004, 19:08
Highly Reputable Member
Join Date: Aug 2003
Location: Australia
Posts: 662
Thanks: 0
Thanked 0 Times in 0 Posts
lol.. I find it soo funny that all of yall push CSS so hard, and 9/10 times CSS isn't supported. lol.. Why use something that doesn't work? I know that it's the politically correct way of doing things.. but heck.. I would much rather use a website that looked good and was awesome, than a website that looked lik total chaos and it say on the front, This website SHOULD look good, but your browser doesnt support my code... THink about it? It's not what's inside that matters, its just how good she looks. That's what is important about webdesign..

Also, on the changing point.. They are going to be changing the internet and computers constantly, in 5 years I doubt we will be using the same coding that we use today.. So you can't plan ahead when designing cause you never know what is coming next.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #12  
Old Apr 14th, 2004, 19:18
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
<blockquote id="quote"><font size="1" face="geneva, verdana, arial" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by benbacardi

what can you do in CSS to accomplish this though?
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">read my first post in this thread.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #13  
Old Apr 14th, 2004, 19:27
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
CSS works fine, it's poor-quality code from both website <u>and</u> browsers that fails it.

If you're still designing web sites in terms of what you think looks 'awesome' and 'cool' then you've barely touched the surface of web design and development.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #14  
Old Apr 14th, 2004, 22:16
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
There's a few things XHTML strict/CSS just doesn't really do yet and vertical centering of a page is in some situations is one of them. (Setting a target for a link is another) There's some tricks that work in some browsers some of the time, but nothing that works as well as the old table tricks for centering a page. I've searched the web extensively and tried everything I found and yet I'm back to tables for centering a layout.

On a side note, even if your code is XHTML strict compliant I've found that it renders more consistently across browsers by using the transitional doctype. And I agree with Sirkent that results is more important than compliance - at least until the standard mature more.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #15  
Old Apr 15th, 2004, 08:58
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,184
Blog Entries: 7
Thanks: 27
Thanked 22 Times in 19 Posts
Well, I too would have to agree with Sirkent....
However, we should all try CSS on a layout <font color="red">BEFORE</font id="red"> reverting to injecting loads of additional table code and other unneeded drivel, etc

As most of you know, Myself and D3mon got www.seacrofthotel.co.uk fully cross browser compatible (at least with windows browsers) using Strict XHTML 1.1 and CSS 2.0, so ya'll who are saying it is not properly supported, may just in fact not be trying hard enough.

There is usually a way with CSS to make everything work across browsers (except for a small portion of designs), and I for one and probabally D3mon too would much rather be helping you to sort out small issues now, than later when you decide all the benefits of CSS and compliant code outway the costs of old-hat design methods and you wanna re-work entire sites.

It can be done people.... it's happening all over the web. Open yer eyes if you are a non believer.

Just my $0.02 worth.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #16  
Old Apr 15th, 2004, 16:54
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
The keywords being "windows browsers". I've had good success with Strict/CSS2 in that as well, other than the couple unsupported items that I sometimes need. But on Macs the design is totally hosed - even reverting to transitional there's still problems. So I'm slowly working backward from fully compliant code, adding tables as needed (not that it isn't compliant to use tables but still...)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #17  
Old May 27th, 2004, 13:47
Reputable Member
Join Date: Aug 2003
Location: Singapore
Posts: 321
Thanks: 0
Thanked 0 Times in 0 Posts
I managed to center both vertically and horizontally in my website www.gwx.biz. Have a look at the code and stylesheet.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #18  
Old May 27th, 2004, 13:51
Reputable Member
Join Date: Aug 2003
Location: Singapore
Posts: 321
Thanks: 0
Thanked 0 Times in 0 Posts
ok to be more precise... this is what you do.

enclose your CSS stuffs into a container <DIV> tag and in a stylesheet, define container as... use your own height, width properties. make sure its relative positioning and make sure the margin property is still there. text-align is to make it work on Netscape 6 I believe. ( although its for something totally diffrent, ts required in NS6 due to buggy standards )

.container {
position: relative;
height: 600px;
width: 955px;
margin: 0 auto;
text-align: left;
}

Next, enclose your <DIV> tags with tables and a <td> tag. Apply the following in your stylesheet.

table {
width: 100%;
height: 100%;
}

td {
vertical-align: middle;
text-align: center;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
centering, vertically

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Centering Vertically R8515198 Web Page Design 5 Dec 6th, 2007 11:05
[SOLVED] Centering horizontally and vertically Emzi Web Page Design 4 Nov 1st, 2007 16:07
Align text vertically in a box josoap Web Page Design 3 Jul 12th, 2007 17:29
Rotating vertically grizzlyman Starting Out 2 Apr 7th, 2007 19:46
Vertically centering Div's verkevinmanering69err455 Web Page Design 3 Mar 19th, 2007 17:22


All times are GMT. The time now is 05:49.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10