Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    12
    Member #
    15688
    I am totally new to html. I need to make my page to stay centered no matter what resolution.

  2.  

  3. #2
    Senior Member Kayo's Avatar
    Join Date
    Dec 2006
    Location
    Brampton Ontario
    Posts
    416
    Member #
    14523
    Liked
    39 times
    add a <div> around the content of the page (I used 'center' as the label) and in the header add some css code.
    HTML Code:
    <html>
    <head>
    <style type="text/css">
    #center {
    width: 850px;
    margin: 0px auto;
    }
    </style>
    </head>
    <body>
    <div id="center">
    ...
    </div>
    </body>
    you could change the width, but you need to set a width, or it would be a dyamic width, and would just stretch the content, therefore, no centering.

  4. #3
    Senior Member Ferro's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    386
    Member #
    14204
    Liked
    5 times
    Also adding a "text-align:center;" to the body for IE.

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Yes. If it weren't for IE, you could actually just set an absolute width and a margin: 0 auto directly to the body.

  6. #5
    Junior Member
    Join Date
    Aug 2007
    Posts
    12
    Member #
    15688
    thanks for the help everybody! I will try it today.

  7. #6
    Junior Member
    Join Date
    Aug 2007
    Posts
    12
    Member #
    15688
    It worked!!! Now I have a couple other question...I'm using image ready and go live. The page shows up fine in safari but in firefox, the links made the page messed up (slices are moved). What could be the fix for this? Also, I want a background color. How do I do this and keep the page always centered.
    Thanks again.

  8. #7
    Senior Member Ferro's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    386
    Member #
    14204
    Liked
    5 times
    Perhaps the "tex-align:center" caried over to your content div and made the links appear in different places? Hard to tell without you showing us.
    Maybe if that;s the case you should put "text-align:left" into your content div?

  9. #8
    Junior Member
    Join Date
    Aug 2007
    Posts
    12
    Member #
    15688
    here is the site address

    www.creativeschoolzone.com/test3.html

    the page was fine until I put the links in go live

  10. #9
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    boy, this is the bad thing about using tables for layouts.

    first of all, get rid of the borders around your links by
    putting this in the top <style> section

    img, img a {
    border: none;
    }


    So it looks like this:

    <style type="text/css">
    #center {
    width: 800px;
    margin: 0px auto;
    }

    img, img a {
    border: none;
    }
    </style>


    See what that does first.

    Then, you're sort of stuck on some width issues.
    Removing image borders might fix it, but with a body width of 800,
    you can't exceed that with your tables. Try making your body
    width something like 820px and see what happens.
    (that would be in the <style> section ).


  11. #10
    Junior Member
    Join Date
    Aug 2007
    Posts
    12
    Member #
    15688
    thanks for the help mlseim, I got the slices to fit correctly.

    Last thing....how do I get a background color (behind my page) and still have the page always centered?


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

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

Search tags for this page

web css always centered

Click on a term to search for related topics.
All times are GMT -6. The time now is 03:33 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com