How do I make the image to be centered on the table

Asked

Viewed 120 times

1

                      <html>
              <head>
                <title> Teste inicial </title>
              </head>
               <body>
                  <table style= "width:480" "height:480" border="1">
               <tr>
               <th colspan="2" > Nome Principal </th>
               </tr>
               <tr> 
<td> Lacuna 1</td>
<td> Lacuna 2 </td> 
  </tr>
  <tr>
      <td height="80" > Lacuna 3</td>
  <td height="80" > Lacuna 4 </td> 
  </tr>
  <tr>
    <td colspan="3">
      <table border ="5">
        <tr>
          <td colspan="2"><img src="instagram-1581266_960_720.jpg " style="width:180px;">
          </td>
        </tr>
      </table>
    </td>

  </tr>

2 answers

0

Put in the <td> the centralized alignment:

<td align="center">
   <img src="uma_imagem.jpg" />
</td>
  • Let me start by saying that I did not give the -1 and I think it is exaggerated that they did it once it works. But I suggest you put a note saying that although it is possible to do as you have in the answer, it is recommended that it be done in CSS

  • Quiet. I already think it’s better to use the element’s native functions instead of using CSS.

0

The DVD response is correct but I recommend you follow the W3C standards for HTML5.2, because at some point this format used to align will not be supported by browsers and you will have to redo your site again, since this format is already deprecated since HTML 5.0, as well as all attributes of only visual meaning, because there are the CSS for this and the image issue is also wrong because according to the W3C every image should have an alt alternative text and with that the right code would be like this:

<td style="text-align:center;">
   <img src="minhaImagem.jpg" alt="Está é uma imagem de alguma coisa"/>
</td>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.