Centering an image for any resulition

Discussion in 'HTML' started by mr_vocab, May 22, 2004.

  1. mr_vocab

    mr_vocab Guest

    what sort of hatml code could i use so that any computer at any resultion
    could see a picture in the dead centre of their screen?
     
    mr_vocab, May 22, 2004
    #1
    1. Advertising

  2. mr_vocab

    brucie Guest

    in post: <news:>
    mr_vocab <> said:

    > what sort of hatml code could i use so that any computer at any resultion
    > could see a picture in the dead centre of their screen?


    you cant get dead center of their screen as their window may not cover
    100% of the screen area and even if it does the window may have elements
    like menu/scroll/tool bars etc that will cause the image to be displayed
    off center to the screen.

    html,body{height:100%;width:100%;margin:0;padding:0;display:table;}
    div{width:100%;height:100%;text-align:center;vertical-align:middle;display:table-cell;}

    <div><img...></div>

    centering thingys
    http://dorward.me.uk/www/centre/
    http://www.w3.org/Style/Examples/007/center.html
    http://www.student.oulu.fi/~laurirai/www/css/middle/
    http://hicksdesign.co.uk/articles/css/vertical_centering_with_css/

    --
    b r u c i e
     
    brucie, May 22, 2004
    #2
    1. Advertising

  3. mr_vocab

    Oliver Guest

    mr_vocab wrote:

    > what sort of hatml code could i use so that any computer at any resultion
    > could see a picture in the dead centre of their screen?



    If there is nothing else on your page but that image, you can also set
    is as a background like this:

    body {
    background: #000000 url("someimage.png") no-repeat center center;
    color: #ffffff;
    }

    --
    Oliver
    mailto: olli(at)xs4all(dot)nl
     
    Oliver, May 22, 2004
    #3
  4. mr_vocab

    mr_vocab Guest

    great thanks :)
    "brucie" <> wrote in message
    news:...
    > in post: <news:>
    > mr_vocab <> said:
    >
    > > what sort of hatml code could i use so that any computer at any

    resultion
    > > could see a picture in the dead centre of their screen?

    >
    > you cant get dead center of their screen as their window may not cover
    > 100% of the screen area and even if it does the window may have elements
    > like menu/scroll/tool bars etc that will cause the image to be displayed
    > off center to the screen.
    >
    > html,body{height:100%;width:100%;margin:0;padding:0;display:table;}
    >

    div{width:100%;height:100%;text-align:center;vertical-align:middle;display:t
    able-cell;}
    >
    > <div><img...></div>
    >
    > centering thingys
    > http://dorward.me.uk/www/centre/
    > http://www.w3.org/Style/Examples/007/center.html
    > http://www.student.oulu.fi/~laurirai/www/css/middle/
    > http://hicksdesign.co.uk/articles/css/vertical_centering_with_css/
    >
    > --
    > b r u c i e
    >
    >
     
    mr_vocab, May 23, 2004
    #4
  5. mr_vocab

    mr_vocab Guest

    hi

    gtreat thanks for the tips
    "Oliver" <> wrote in message
    news:40af39c2$0$568$4all.nl...
    > mr_vocab wrote:
    >
    > > what sort of hatml code could i use so that any computer at any

    resultion
    > > could see a picture in the dead centre of their screen?

    >
    >
    > If there is nothing else on your page but that image, you can also set
    > is as a background like this:
    >
    > body {
    > background: #000000 url("someimage.png") no-repeat center center;
    > color: #ffffff;
    > }
    >
    > --
    > Oliver
    > mailto: olli(at)xs4all(dot)nl
     
    mr_vocab, May 24, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry Camel

    Centering an image with text

    Jerry Camel, Sep 23, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    544
    John Timney \(ASP.NET MVP\)
    Sep 23, 2005
  2. Richard

    Re: Centering image on page?

    Richard, Jun 25, 2003, in forum: HTML
    Replies:
    0
    Views:
    3,784
    Richard
    Jun 25, 2003
  3. Jerry Muelver

    Re: Centering image on page?

    Jerry Muelver, Jun 25, 2003, in forum: HTML
    Replies:
    0
    Views:
    848
    Jerry Muelver
    Jun 25, 2003
  4. Samuël van Laere

    Image centering

    Samuël van Laere, Dec 5, 2004, in forum: HTML
    Replies:
    4
    Views:
    539
    David Dorward
    Dec 5, 2004
  5. Steve Greenaway

    Something about image centering

    Steve Greenaway, Dec 5, 2004, in forum: HTML
    Replies:
    3
    Views:
    418
    David Dorward
    Dec 5, 2004
Loading...

Share This Page