943,957 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Apr 14th, 2008
0

Re: How to vertically center your page's content in FF and IE.

Several facts:

- The viewport height is not normally something the page rendering engine takes into account. It is expected to place things against the top, and then add them on downward until it runs out of material. The emphasis is in fitting things to the page horizontally. If it won't fit, the page expands downward.

- Vertical centering is not generally provided, because of the above, and because different computers have different screen resolutions.

- It is almost impossible to make something exactly fit a page in all browsers, screen resolutions, font size settings, opened window sizes, and browser defaults.

- You can define styles for the td and th tags setting the text-align and vertical-align styles to what you want. This overrides the browser defaults.

- To keep stuff from rendering different between IE and FF, do not put size styles (height and width) and nonzero surrounding styles (margin, border, and padding) in the same tags or styles. IE and FF render them in the opposite nesting order. Use two nested tag pairs to specify the order they will be applied.

I suggest that you center things horizontally, and let the vertical parts end up where they do. Busting your buttons over trying to center stuff on the page vertically in all browsers and window sizes is a waste of time.
Last edited by MidiMagic; Apr 14th, 2008 at 5:53 pm.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Apr 14th, 2008
0

Re: How to vertically center your page's content in FF and IE.

is
HTML and CSS Syntax (Toggle Plain Text)
  1. <table align="center">
Not standard anymore? Because thats always worked in both browsers for me. Assuming all the content is inside one main table.
Team Colleague
Reputation Points: 55
Solved Threads: 39
A.K.A. The Laughing Man
kylethedarkn is offline Offline
600 posts
since May 2006
Apr 22nd, 2008
0

Re: How to vertically center your page's content in FF and IE.

Use styles instead of center or align=center.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Apr 22nd, 2008
0

Re: How to vertically center your page's content in FF and IE.

Its a pain I have been searching on the internet, like midimagic said "there is no solution".

So just do your best I guess

Thanks anyways, people.
Reputation Points: 31
Solved Threads: 10
Practically a Master Poster
OmniX is offline Offline
652 posts
since Dec 2007
May 21st, 2008
0

Re: How to vertically center your page's content in FF and IE.

is
HTML and CSS Syntax (Toggle Plain Text)
  1. <table align="center">
Not standard anymore? Because thats always worked in both browsers for me. Assuming all the content is inside one main table.
This code would indeed center the contents horizontally, but I use
HTML and CSS Syntax (Toggle Plain Text)
  1. <table width=100% height=100%> [line was previously: <table align="center" valign="center">]
  2. <tr>
  3. <td align="center" valign="center">
  4. ...
  5. </td>
  6. </tr>
  7. </table>
to center both horizontally and vertically. When the window changes size, the content adjusts to remain centered. It works in IE and FF , but not sure if this is the way you would go about properly aligning multiple-celled tables though...
Last edited by honorsmacked; May 21st, 2008 at 10:48 pm. Reason: to properly format table, had a centering issue
Reputation Points: 10
Solved Threads: 0
Newbie Poster
honorsmacked is offline Offline
1 posts
since May 2008
May 21st, 2008
0

Re: How to vertically center your page's content in FF and IE.

Ya thats sorta cheating as I was hoping to find a css solution but pretty much thats what I have had to end up resorting to, but thanks
Reputation Points: 31
Solved Threads: 10
Practically a Master Poster
OmniX is offline Offline
652 posts
since Dec 2007
May 21st, 2008
0

Re: How to vertically center your page's content in FF and IE.

You've tried:

table{
position:absolute;
left:25%;
}

right?
Team Colleague
Reputation Points: 55
Solved Threads: 39
A.K.A. The Laughing Man
kylethedarkn is offline Offline
600 posts
since May 2006
May 25th, 2008
0

Re: How to vertically center your page's content in FF and IE.

Horizontal centering is easy, if you don't have size styles (height, width) and nonzero surrounding styles (margin, border, padding) applied to the same tag. Nest two tags if you need both.

The Internet is not designed for vertical centering. Web pages are designed to expand downward when they need more room. Add in different screen resolutions and window sizes (The browser might be restored down - and don't forget Web TV's 320x192 pixel screen), and the impossibility of vertical centering is quite evident.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: horizontal divs
Next Thread in HTML and CSS Forum Timeline: alternative to iframes





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC