Results 1 to 9 of 9

Thread: Center Image

  1. #1
    Join Date
    Mar 2007
    Location
    Kent
    Posts
    11,415
    Tokens
    787

    Latest Awards:

    Default Center Image

    How would i center a image in the middle of the page in CSS?

    All help shall get sexy rep ;]

  2. #2
    Join Date
    Mar 2008
    Location
    Cardiff, S. Wales
    Posts
    536
    Tokens
    0

    Default

    Margin: Auto;

  3. #3
    Join Date
    Mar 2007
    Location
    Kent
    Posts
    11,415
    Tokens
    787

    Latest Awards:

    Default

    Quote Originally Posted by iTech View Post
    Margin: Auto;
    Would that align it in the middle of the page, equal margins top,bottom,left and right?

  4. #4
    Join Date
    Mar 2008
    Location
    Cardiff, S. Wales
    Posts
    536
    Tokens
    0

    Default

    Quote Originally Posted by today View Post
    Would that align it in the middle of the page, equal margins top,bottom,left and right?
    Should shove it in the middle.
    Margins are left & right, I do believe.

  5. #5
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Quote Originally Posted by today View Post
    Would that align it in the middle of the page, equal margins top,bottom,left and right?
    You can't do exact horizontal center alignment with CSS, you'll have to use JS for that .
    But for vertical alignment to the centre of the page margin: auto; should work .

  6. #6
    Join Date
    Mar 2007
    Location
    Kent
    Posts
    11,415
    Tokens
    787

    Latest Awards:

    Default

    Quote Originally Posted by --ss-- View Post
    You can't do exact horizontal center alignment with CSS, you'll have to use JS for that .
    But for vertical alignment to the centre of the page margin: auto; should work .
    Would it be valid doing so?

  7. #7
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by --ss-- View Post
    You can't do exact horizontal center alignment with CSS, you'll have to use JS for that .
    But for vertical alignment to the centre of the page margin: auto; should work .
    Yes you can:

    fix the width (i.e 90% or whatever)

    then "margin: 0 auto;" will fix it to the exact horizontal centre of the page.

    Just put the image in the div and it'll align itself inside the div (the div will move to the centre and the image will go with it)


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  8. #8
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    margin-left: auto;
    margin-right: auto;
    text-align: left;

    That should work
    Lets set the stage on fire, and hollywood will be jealous.

  9. #9
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    View the code at pixstudios.net, that has vertical & horizontal centering.

Posting Permissions

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