How to move text up in a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • demif
    New Member
    • Feb 2015
    • 1

    How to move text up in a table

    I currently have a table that looks like this: http://s8.postimg.org/gybzti0rn/Screen_Shot_201 5_02_27_at_1_30 _23_PM.png

    I want to move the description of the boat up to the top of the image. I tried using valign="top", but this moved the description to the very top of the table, where the boat name is.

    Here is my HTML:
    Code:
     
    <table border ="1">
    <tr>
        <th> Boat Name </th>
      <th rowspan="2">Description</th>
      </tr>
      <tr>
        <td><img src="boatimage.png"></td>
      </tr>      
    </table>
    Thanks in advance for the help!
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    #2
    use CSS
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <style>
    div {
            position: relative;
            left: 10px;
            top: 30px;
            color: yellow;
    }
    </style>
    </head>
    <body>
     <table border ="1">
    <tr>
        <th> Boat Name </th>
      <th rowspan="2">Description</th>
      </tr>
      <tr>
        <td>
            <div>Boat Name</div>
            <img src="testimage.jpg" height="200px">
            </td>
      </tr>
    </table>
    </body>
    </html>
    change 'left' and 'top' in the CSS to position the text correct.

    I uses color yellow because my testimage has a dark color.... ;)

    Comment

    Working...