Results 1 to 6 of 6

Thread: locate image on page

  1. #1
    Join Date
    Jan 2008
    Location
    Los Angeles
    Posts
    97
    Thanks
    31
    Thanked 2 Times in 2 Posts

    Default locate image on page

    I'm all questions today...

    Is it possible to locate an image through a "div style" tag next to the image?

    Example (in BODY of page):

    <div style="top: 200px;"><img src="ai-board1.jpg"></div>

    This didn't work for me.

    THANKS.

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    It did work for me:
    HTML Code:
    <div style="top:200px;">
    <img src="http://h1.ripway.com/rangana/images/Picture4.jpg"></div>
    Please provide a link to the page in question.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. The Following User Says Thank You to rangana For This Useful Post:

    questions (08-09-2008)

  4. #3
    Join Date
    Jan 2008
    Location
    Los Angeles
    Posts
    97
    Thanks
    31
    Thanked 2 Times in 2 Posts

    Default

    I had to do this for it to work:
    <div style="margin: 200px;">
    Don't know why...

  5. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    The "top" attribute only does anything if the "position" attribute is set as well (for example, "position: absolute" or "position: relative").
    - Mike

  6. The Following User Says Thank You to mburt For This Useful Post:

    questions (08-09-2008)

  7. #5
    Join Date
    Jan 2008
    Location
    Los Angeles
    Posts
    97
    Thanks
    31
    Thanked 2 Times in 2 Posts

    Default

    Quote Originally Posted by mburt View Post
    The "top" attribute only does anything if the "position" attribute is set as well (for example, "position: absolute" or "position: relative").
    Right! Thanks!

  8. #6
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by questions View Post
    I had to do this for it to work:
    <div style="margin: 200px;">
    Don't know why...
    So you were trying to add 200px between the top of the div and the image? If it's the image that you're aligning, you should generally add the styles to the image. In this case, it would be something like:

    HTML Code:
    <div id="container">
       <img src="image.jpg" alt="image">
    </div>
    Code:
    #container {
       position:relative;
    }
    #container img {
       position:absolute;
       top:200px;
    }

Bookmarks

Posting Permissions

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