GFXVoid Graphic Design Forum

Remove Text Formatting
Loading...

» Online Users: 5,230

0 members and 5,230 guests
No Members online

» Site Navigation

 > FAQ

» Stats

Members: 35,442
Threads: 103,075
Posts: 826,688
Top Poster: cc.RadillacVIII (7,429)
Welcome to our newest member, Lekelindids
Results 1 to 8 of 8

Thread: how to center

  1. #1
    Join Date
    Apr 2009
    Location
    AZ
    Posts
    659

    Default how to center

    a webpage?

    I need some help ive searched but I dont know what code to put in and where!

  2. #2
    Join Date
    Mar 2005
    Location
    USA
    Posts
    1,337

    Default

    Depends on what you want to center. If it's text then you should be centering the p element in css. If it's a block element, there's a number of ways to do it.




  3. #3
    Join Date
    Apr 2009
    Location
    AZ
    Posts
    659

    Default

    it was centering the entire webpage but I managed to figure it out

  4. #4
    Join Date
    Aug 2007
    Posts
    1,259

    Default

    You can always use <center> </center> or what I like to do is, make a <div> with a defined width, then set its left 50&#37;. This will bring the top left corner of the div to be centered on the page width wise. Then just set margin-left to -[half of the width of the div] For example, if my div was 900px wide, I would set the margin-left to -450px.

    Commissions and stickers available via linktree here.

  5. #5
    Join Date
    Mar 2005
    Location
    USA
    Posts
    1,337

    Default

    Another way (my personal favorite) if you are wanting to center a container div, you can use margin-left:auto and margin-right: auto. This only works horizontally, but most of my work spans the whole page lengthwise, so I don't really have to worry about it. The auto trick seems to be pretty cross-browser compatible as well.




  6. #6
    Join Date
    Apr 2009
    Location
    AZ
    Posts
    659

    Default

    okay cool :]

  7. #7
    Join Date
    Nov 2009
    Posts
    3

    Default

    Try to use CSS for all the formatting for a webpage and to center a webpage <div> tag is a best option to use with align as a center.....

  8. #8
    Join Date
    Jul 2005
    Location
    Bristol, England
    Posts
    244

    Default

    Try not to use <center> if you want to keep up with modern times.

    Straight after the <body> tag, its best to enter a <div id="container"> tag, and then close the tag just before the body tag is closed. Using CSS you can center all of the content on the page by using this:

    Code:
    #container {margin:0 auto;}



    "
    I'm just a notch in your bedpost, but you're just a line in a song "


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1