SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Bavarian Alps
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    centering content

    Hi!

    I am trying to center a page created with css in the middle of the screen. The way you can with tables or frames.

    I am not talking about centering a single paragraph or element but rather the whole page. It sounds easy but has defeated me up to now.

    Thanks for any help.

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simply use the DIV element around anything you want centered:
    Code:
    <div align="center">
    <table>
    <tr>
    <td></td>
    </tr>
    </table>
    </div>
    So in your case, you would probably just want to include everything on your page within a div tag like:
    Code:
    <body>
    <div align="center">
    Everything
    </div>
    </body>
    Good luck!
    Last edited by Aes; Sep 30, 2001 at 15:25.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OR...if you are already using a master TABLE around your content, just put align="center" in the TABLE tag.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  4. #4
    Eat, Sleep, *********! J. Pederson's Avatar
    Join Date
    Sep 2001
    Location
    Wisconsin
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Where do I go?

    I need help with cascading style sheets, where can I go to learn the basics. And give me a break if this is a dumb question... I'm only doing this for fun , but I could use some help, I enjoy designing and I want to know how to get better!! !!
    James Pederson - Web Design & Development
    phone: 608.243.7898
    e-mail: james@transparentacoustics.com
    websites: clear speaker box | website development madison

  5. #5
    1-800-JMULDER JMulder's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,745
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    J. Pederson - Here are some sites:

    - Kevin Yank's article @ SitePoint
    - Project Cool's CSS1 Referncce
    - Webmonkey's Index on CSS
    - Google's Searchresults

    I don't know many HTML Tutorial sites, but those are the ones I do know, other Mentors and Advisors probably have a longer list, hope it helps
    Jeroen Mulder

    w: www.jeroenmulder.com

  6. #6
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Bavarian Alps
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Aes!

    What you say is true except that I have used a lot of absolute positioning to get things just where I want them. These absolute divs don't seem to be affected by the align center wrapped around them.

    In the following example the column always stays on the left.

    Maybe the problem is using absolute positioning but how else do I get things where theyshould be?

    Creole: The same applies to tables. Absolute divs ignore everything.

    Thanks both of you and maybe you have a better idea.

    <body class="white">
    <div align="center">
    <div style="position: absolute; top: 10px; left: 10px; width: 150px; height: 1000px; background-color: #336601;">
    asdasdd
    </div>
    </div>
    </body>

  7. #7
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeppers...

    I was afraid you were going to say that. I actually thought about mentioning that in my previous post but I figured I'd take the easy route.

    Basically, since you're abpos'ing everything, you've got two choices.

    1) Leave the site the way it is, left-aligned.

    2) Recode the site and use relative positioning.

    Those are your only choices.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •