www.webdeveloper.com
Results 1 to 6 of 6

Thread: website will not center

  1. #1
    Join Date
    Oct 2010
    Posts
    2

    website will not center

    hello

    this might be an easy question,

    i have updated the first page of this website and it just will not center in firefox and crome.

    it centers in internet explorer, I hope someone can help me

    I have uploaded the html files to yousendit
    http://www.yousendit.com/download/WT...dzhtNEx2Wmc9PQ

    thanks

  2. #2
    Join Date
    Aug 2006
    Posts
    1,897
    text-align:center is not the way to center a page. Try:
    Code:
    .tcenter {width:1215px;margin:0 auto}
    Dave

  3. #3
    Join Date
    Oct 2010
    Posts
    2
    thanks working now

  4. #4
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,207
    Centering:

    Centering anything requires setting a width less than 100% for the container. Example:

    body {
    width: 950px;
    height: 600px;
    margin: 0 auto;
    background: #fff url(path to non-tiled image) no-repeat center scroll;
    }

    Change parameters as you need. Set "#fff" to background color you want.

    Additional info:

    Set "scroll" to "fixed" if you want page contents to scroll over background image. CSS was given for an image that does not tile.

    If you have a small image and want it to fill the entire browser window, see these sites for examples of code to use:

    Background to Fit Screen II: http://paynelessdesigns.pastebin.com/f760990b
    http://www.cssplay.co.uk/layouts/background
    http://www.scriptdungeon.com/freejav...reescripts1284
    http://css-tricks.com/perfect-full-p...kground-image/

  5. #5
    Join Date
    Oct 2010
    Location
    On a BOAT!
    Posts
    7

    <center> tag ??...

    why don't you just use the <center>(Body contents here)</center>?
    Code:
    <html>
    <head>
    <title>Title of page</title>
    <script>
    </script>
    </head>
    <body><center>
    <!--Contents....
    <!--Contents....
    </center></body>
    </html>

  6. #6
    Join Date
    Aug 2006
    Posts
    1,897
    Quote Originally Posted by wethammy123 View Post
    why don't you just use the <center>(Body contents here)</center>?
    Because <center> is a deprecated tag, and shouldn't be used in modern code.

    Dave

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles