Align Text by Coordinates!?!?

Discussion in 'HTML & Website Design' started by WillMarflow, Nov 6, 2008.

  1. #1
    Hi,

    I want to place some text on a big image I have on a page.

    There is an exact room for the text in the image, so I would like to use coordinates somehow to place some text on the image at that spot.

    I thought I might be able to do it using Image Maps?

    Please help me out, I´m stuck!

    I´ll pay $5 to the person that first gives the right solution.

    Thanks
     
    WillMarflow, Nov 6, 2008 IP
  2. Christian Little

    Christian Little Peon

    Messages:
    1,753
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is the image always in the same location on the page? If so, then don't bother with imagemaps, use CSS:

    .mytext {
    position: absolute;
    top: 400px;
    left: 200px;
    }

    <div class="mytext">this is my text</div>

    That will place the text exactly 400px from the top and 200px from the left in the window. Just figure out the location of the image and you're all set.
     
    Christian Little, Nov 6, 2008 IP
  3. WillMarflow

    WillMarflow Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for that Christian.

    The image is always in the same spot, but our site is centered so depending on users screen resolution and browser window size the image can be on a different place in regards to coordinations.

    Is there a way to use percentages instead, or to specify the coordinates within the actual page?

    Looking forward to your reply.
     
    WillMarflow, Nov 6, 2008 IP
  4. Christian Little

    Christian Little Peon

    Messages:
    1,753
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can use percentages instead:

    position: absolute;
    top: 25%;
    left: 10%;

    for example.
     
    Christian Little, Nov 6, 2008 IP
  5. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Or, if you have it like this:

    <img src="theimg.jpg" />
    <div class="mytext">this is my text</div>

    Then:
    .mytext { margin-top: -35px; }
    Then alter this to wherever you want it, a negative margin will push it upwards over the picture..

    Or alternatively add the image as a background to the DIV and add the text inside the DIV.
     
    wd_2k6, Nov 6, 2008 IP