Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Center an image with div in CSS that works in all browsers?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35256
    chicacalva
    Member

    Hellooo! So I have this huge image, for example:
    http://i43.tinypic.com/zv7p6e.jpg

    and I want to create a code in CSS using a div to align
    the image, so I have something like this:

    .lay{
    top:-40px;
    left:30px;
    position:absolute;
    }

    and then in the HTML code, I will specify the div and add
    the image:





    but when I use the margins that I have, the image positions differently
    on different browsers and doesn’t look centered. How can I get the image to
    position in the center the same in any browser?

    Thank you!

    #91003
    chrisburton
    Participant

    Why would you use an image for any of that? You can create it with CSS.

    #91977
    mayurroyal
    Member

    try “text-align:center” for horizontally Center the image

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.