HighDots Forums  

vert and hor centering text in <div>

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss vert and hor centering text in <div> in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John Pote
 
Posts: n/a

Default vert and hor centering text in <div> - 07-25-2006 , 05:38 AM






1. Horizontal centering a <div> in browser window.

The current trend seems to be to place page content in a fixed width area in the middle of the
browser window. How is this achieved? If I use a top level <div> then I can place it with CSS
attribute 'left:', but this is a fixed offset. Is it possible to have a <div> centered in the
browser window?


2. Verticle centering in <div>

I have a simple link bar at the top of my page with, as you might guess, links to other pages. The
<div> is given a fixed hight to accomodate a background gif. How can CSS be used to vertically
center the text? CSS attribute 'verticle-align:' only seems to center one piece of text against
adjacent text.

Thanks everyone,

John Pote

Reply With Quote
  #2  
Old   
tgscott
 
Posts: n/a

Default Re: vert and hor centering text in <div> - 07-27-2006 , 06:04 AM






Quote:
Thanks for taking the time to reply and your code example that worked fine in centering the 'page'
div> between the browser window edges. Eventually I tracked down why my html code did not work. It
was the DOCTYPE line.
No problem. This sounds like a quirksmode issue. There's a good article
about this here:
http://www.quirksmode.org/css/quirksmode.html



Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.