Menu
Hi all…
I need some help, if possible, and this seems like the right forum to post in.
I’d like to have a graphic and text (in a table) center vertically and horizontally in the browser window. With HTML, I’d normally use the width and height attributes (set at 100%) in a master <TABLE> to do this but XHTML no longer recognizes the height attrib. Any ideas on how to use CSS to now do this?
Thanks,
– Michael H.
[i]Originally posted by plusonetwo [/i]
My overall goal was to have it in the center of a browser window no matter how wide or narrow, etc. Ideas on how to have it vertically in the middle?
[/QUOTE]
[i]Originally posted by plusonetwo [/i]
[B]Alright... I don't understand XHTML all too clearly yet so bear with me.
[/QUOTE]
Your code does work correctly when I copy/paste, however, when I change out what's inside the DIV tag, such as with a graphic, what, if anything, do I have to adjust elsewhere. I say this because, for instance, I put a 349x313 graphic in the DIV and it was pushed off the right side of the browser a bit.
[/QUOTE]
[i]Originally posted by allier [/i]
[B]To acheive what I anderstand you want to do, you should combine absolute and relative positioning like :
<div align="center"><div id="layer33" style="position: relative; left: 0px; width: 826px; height: 136px;">
<div id="Layer39" style="position: absolute; left: 0px; width: 276px; background: #993399; height: 136px;">
...</div></div>
HTH [/B][/QUOTE]
What would be the advantage of this code vs what is already in this thread? [/quote]
[i]Originally posted by allier [/i]
[B]The advantage of a position: relative then a position: absolute is that you can put this layers, anyware in your page,not depending of the height of what is above . [/B][/QUOTE]
The first example of Stefan works... untill you shrink the browser window beyond the size of the DIV size.
The DIV will be kept centered causing the TOP of the DIV to move upward.
[/quote]
0.1.9 — BETA 5.5