put image in table box

Discussion in 'HTML & Website Design' started by rezafh, Jan 28, 2020.

  1. #1
    hi
    i want put image like this picture in box. right before text. but icant
    [​IMG]

    this is my code i used but image goes up or down !

    <table>  <thead>    <tr>      <th width="121">Download link</th>      </tr>  </thead>  <tbody>    <tr>      <td><img src="https://upload7.ir/up/icon-article-navy.png" alt="" width="20" height="20" class="dlboxicon"/>[xfgiven_download]<a href="[xfvalue_download]"> [xfgiven_name] [xfvalue_name] [/xfgiven_name]</td>[/xfgiven_download] <a/>         </tr>  </tbody></table>
    
    Code (markup):
     
    rezafh, Jan 28, 2020 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    What praytell makes this tabular data? This is NOT a candidate to be styled with a TABLE... at all. ESPECIALLY with only one cell per TR. Remember, this is 2020 not 1997, tables for layout is BAD.

    Likewise that image is presentation, not content, so it has ZERO business in an IMG tag, apply it from your CSS.

    I'd make the entire upper area an anchor, set it to inline-block, pad the right side, and put the image as background-image middle-right. If the outer DIV (not a table) is set to text-align:center, the anchor will center.

    NOT a job for the markup you are using whatsoever. Have you learned about semantic markup (aka using HTML properly) or separation of presentation from content? I'm guessing not.
     
    deathshadow, Jan 28, 2020 IP