Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2011
    Location
    Surrey United Kingdom
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Postioning centered horizonally, specifiying the vertical positioning.

    Alright, so what i want to do it center an image using CSS (or whatever will be most efficient).

    I need it to be centered horizontally, but need to specify the vertical positioning, ie 200px from the top. - I am attempting it this way to the images don't shunt when the browser window is re-sized (or i would embed it normally). Am i thinking correctly?

    Many thanks

    george

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    image is an inline element by default, so you could centre it horizontally be setting a text-align:center; to it's parent block level element.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Sep 2011
    Location
    Surrey United Kingdom
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    image is an inline element by default, so you could centre it horizontally be setting a text-align:center; to it's parent block level element.
    Thanks for the reply.

    I was just trying to workout how to implement what you suggested, i imagine it's something like this:

    Code:
    #image2
    {
    text-align:center;
    background-position: center 200px,
    background-image:url(/images/content_top.png);
    background-repeat:no-repeat
    I'm 90% sure that's wrong somewhere, i'm new to CSS, please correct me!

    Thanks again

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Can we have a link to your page?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Tags for this Thread

    Posting Permissions

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