用文本调整表格中的图像

时间:2016-08-29 08:10:49

标签: html css html-table

我想在每张图片下面用各自的文字调整图像。

一行中有四个图像。和其他四个在第二行。

当我从第一行删除任何图片,然后从第二行删除时,第一张图片应放在第一行的最后一行

就像队列

一样

        <table>
            <tr>
                <td></td>
            </tr>
            <tr>
                <td>
                    <!--First Row-->
                    <!--Speaker 1 -->
                    <table align="left" border="0" cellpadding="0" cellspacing="0"
                    style=
                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                    <tbody>
                            <tr>
                                <td align="center">
                                    <table align="center" border="0" cellpadding=
                                    "0" cellspacing="0" style=
                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"
                                    width="110">
                                        <tbody>
                                            <tr>
                                                <td align="center" height="110"
                                                valign="top" width="110">
                                                    <p style=
                                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <a class="modimg" href="#"
                                                    style=
                                                    "text-decoration: none!important;">
                                                    <img alt="" border="0" height=
                                                    "110" src=
                                                    "http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455301580.jpeg"
                                                    style=
                                                    "display: block !important; border: 3px solid #ffcbbc ; outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;"
                                                    width="110"></a></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="h2" style=
                                "font-weight: bold ;font-family: 'Montserrat', sans-serif;padding-top: 2px;padding-bottom: 0px;color:#ffffff;">
                                <p style=
                                "padding: 0; margin: 0 auto; max-width: 110px; text-align: center;font-size: 10px;">
                                    <span class="wrap_textbox">Mr. Mahesh
                                    Murthy</span></p>
                                    <p style=
                                    "padding:0; margin:0 auto;text-align: center !important; max-width:110px; font-size: 8px;">
                                    <span class="wrap_textbox">Co-Founder at
                                    Seefund</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table><!--Speaker 2-->
                    <table align="left" border="0" cellpadding="0" cellspacing="0"
                    style=
                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt; margin: 0 auto; margin-left: 15px;">
                    <tbody>
                            <tr>
                                <td align="center">
                                    <table align="center" border="0" cellpadding=
                                    "0" cellspacing="0" style=
                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"
                                    width="110">
                                        <tbody>
                                            <tr>
                                                <td align="center" height="100"
                                                valign="top" width="110">
                                                    <p style=
                                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <a class="modimg" href="#"
                                                    style=
                                                    "text-decoration: none!important;">
                                                    <img alt="" border="0" height=
                                                    "110" src=
                                                    "http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455949782.jpeg"
                                                    style=
                                                    "display: block !important; border: 3px solid #ffcbbc ; outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;"
                                                    width="110"></a></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="h2" style=
                                "font-weight: bold ;font-family: 'Montserrat', sans-serif;padding-top: 2px;padding-bottom: 0px;color:#ffffff;">
                                <p style=
                                "padding: 0; margin: 0 auto; max-width: 110px; text-align: center;font-size: 10px;">
                                    <span class="wrap_textbox">Mr. R.
                                    Chandrasekhar</span></p>
                                    <p style=
                                    "padding:0; margin:0 auto; max-width:110px;text-align: center !important; font-size: 8px;">
                                    <span class="wrap_textbox">President at
                                    NASSCOM</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table><!--Speaker 3 -->
                    <table align="left" border="0" cellpadding="0" cellspacing="0"
                    style=
                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt; margin: 0 auto; margin-left: 15px;">
                    <tbody>
                            <tr>
                                <td align="center">
                                    <table align="center" border="0" cellpadding=
                                    "0" cellspacing="0" style=
                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"
                                    width="120">
                                        <tbody>
                                            <tr>
                                                <td align="center" height="100"
                                                valign="top" width="100">
                                                    <p style=
                                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <a class="modimg" href="#"
                                                    style=
                                                    "text-decoration: none!important;">
                                                    <img alt="" border="0" height=
                                                    "110" src=
                                                    "http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455627060.jpeg"
                                                    style=
                                                    "display: block !important; border: 3px solid #ffcbbc ; outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;"
                                                    width="110"></a></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="h2" style=
                                " font-weight: bold ;font-family: 'Montserrat', sans-serif;padding-top: 2px;padding-bottom: 0px;color:#ffffff;">
                                <p style=
                                " padding: 0; margin: 0 auto; max-width: 110px; text-align: center;font-size: 10px;">
                                    <span class="wrap_textbox">Mr. Jay
                                    Panda</span></p>
                                    <p style=
                                    "padding:0; margin:0 auto;text-align: center !important; max-width:110px; font-size: 8px;">
                                    <span class="wrap_textbox">Member of
                                    Parliament</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table><!--Speaker 4 -->
                    <table align="left" border="0" cellpadding="0" cellspacing="0"
                    style=
                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt; margin: 0 auto; margin-left: 15px;">
                    <tbody>
                            <tr>
                                <td align="center">
                                    <table align="center" border="0" cellpadding=
                                    "0" cellspacing="0" style=
                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"
                                    width="120">
                                        <tbody>
                                            <tr>
                                                <td align="center" height="100"
                                                valign="top" width="100">
                                                    <p style=
                                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <a class="modimg" href="#"
                                                    style=
                                                    "text-decoration: none!important;">
                                                    <img alt="" border="0" height=
                                                    "110" src=
                                                    "http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455300140.jpeg"
                                                    style=
                                                    " display: block !important; border: 3px solid #ffcbbc ; outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;"
                                                    width="110"></a></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="h2" style=
                                " font-weight: bold ;font-family: 'Montserrat', sans-serif;padding-top: 2px;padding-bottom: 0px;color:#ffffff;">
                                <p style=
                                " padding: 0; margin: 0 auto; max-width: 110px; text-align: center;font-size: 10px;">
                                    <span class="wrap_textbox">Ms. Shazia
                                    Ilmi</span></p>
                                    <p style=
                                    "padding:0; margin:0 auto;text-align: center !important; max-width:110px; font-size: 8px;">
                                    <span class="wrap_textbox">Spokesperson at
                                    BJP</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr><!--More Speakers-->
            <tr>
                <td></td>
            </tr>
            <tr>
                <td>
                    <!--Second Row-->
                    <!--Speaker 5 -->
                    <table align="left" border="0" cellpadding="0" cellspacing="0"
                    style=
                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                    <tbody>
                            <tr>
                                <td align="center">
                                    <table align="center" border="0" cellpadding=
                                    "0" cellspacing="0" style=
                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"
                                    width="120">
                                        <tbody>
                                            <tr>
                                                <td align="center" height="100"
                                                valign="top" width="100">
                                                    <p style=
                                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <a class="modimg" href="#"
                                                    style=
                                                    "text-decoration: none!important;">
                                                    <img alt="" border="0" height=
                                                    "110" src=
                                                    "http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455299755.jpeg"
                                                    style=
                                                    " display: block !important; border: 3px solid #ffcbbc ; outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;"
                                                    width="110"></a></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="h2" style=
                                " font-weight: bold ;font-family: 'Montserrat', sans-serif;padding-top: 2px;padding-bottom: 0px;color:#ffffff;">
                                <p style=
                                " padding: 0; margin: 0 auto; max-width: 110px; text-align: center;font-size: 10px;">
                                    <span class="wrap_textbox">Mr. Alok
                                    Bansal</span></p>
                                    <p style=
                                    "padding:0; margin:0 auto;text-align: center; max-width:110px; font-size: 8px;">
                                    <span class="wrap_textbox">Co-Founder at
                                    Policybazaar</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table><!--Speaker 6-->
                    <table align="left" border="0" cellpadding="0" cellspacing="0"
                    style=
                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt; margin: 0 auto; margin-left: 15px;">
                    <tbody>
                            <tr>
                                <td align="center">
                                    <table align="center" border="0" cellpadding=
                                    "0" cellspacing="0" style=
                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"
                                    width="120">
                                        <tbody>
                                            <tr>
                                                <td align="center" height="100"
                                                valign="top" width="100">
                                                    <p style=
                                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <a class="modimg" href="#"
                                                    style=
                                                    "text-decoration: none!important;">
                                                    <img alt="" border="0" height=
                                                    "110" src=
                                                    "http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455298163.jpeg"
                                                    style=
                                                    " display: block !important; border: 3px solid #ffcbbc ; outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;"
                                                    width="110"></a></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="h2" style=
                                " font-weight: bold ;font-family: 'Montserrat', sans-serif;padding-top: 2px;padding-bottom: 0px;color:#ffffff;">
                                <p style=
                                " padding: 0; margin: 0 auto; max-width: 110px; text-align: center;font-size: 10px;">
                                    <span class="wrap_textbox">Mr. Arjun
                                    Handa</span></p>
                                    <p style=
                                    "padding:0; margin:0 auto;text-align: center !important; max-width:110px; font-size: 8px;">
                                    <span class="wrap_textbox">Vice chairmain and
                                    MD at Claris Life Sciences</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table><!--Speaker 7 -->
                    <table align="left" border="0" cellpadding="0" cellspacing="0"
                    style=
                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt; margin: 0 auto; margin-left: 15px;">
                    <tbody>
                            <tr>
                                <td align="center">
                                    <table align="center" border="0" cellpadding=
                                    "0" cellspacing="0" style=
                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"
                                    width="120">
                                        <tbody>
                                            <tr>
                                                <td align="center" height="100"
                                                valign="top" width="100">
                                                    <p style=
                                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <a class="modimg" href="#"
                                                    style=
                                                    "text-decoration: none!important;">
                                                    <img alt="" border="0" height=
                                                    "110" src=
                                                    "http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455297276.jpeg"
                                                    style=
                                                    " display: block !important; border: 3px solid #ffcbbc ; outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;"
                                                    width="110"></a></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="h2" style=
                                " font-weight: bold ;font-family: 'Montserrat', sans-serif;padding-top: 2px;padding-bottom: 0px;color:#ffffff;">
                                <p style=
                                " padding: 0px; margin: 0 auto; max-width: 110px; text-align: center;font-size: 10px;">
                                    <span class="wrap_textbox">Ms. Padmaja
                                    Ruparel</span></p>
                                    <p style=
                                    "padding:0; margin:0 auto;text-align: center !important; max-width:110px; font-size: 8px;">
                                    <span class="wrap_textbox">President Indian
                                    Angel Network</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table><!--Speaker 8 -->
                    <table align="left" border="0" cellpadding="0" cellspacing="0"
                    style=
                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt; margin: 0 auto; margin-left: 15px;">
                    <tbody>
                            <tr>
                                <td align="center">
                                    <table align="center" border="0" cellpadding=
                                    "0" cellspacing="0" style=
                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"
                                    width="120">
                                        <tbody>
                                            <tr>
                                                <td align="center" height="100"
                                                valign="top" width="100">
                                                    <p style=
                                                    "border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <a class="modimg" href="#"
                                                    style=
                                                    "text-decoration: none!important;">
                                                    <img alt="" border="0" height=
                                                    "110" src=
                                                    "http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455797754.png"
                                                    style=
                                                    " display: block !important; border: 3px solid #ffcbbc ; outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;"
                                                    width="110"></a></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="h2" style=
                                " font-weight: bold ;font-family: 'Montserrat', sans-serif;padding-top: 2px;padding-bottom: 0px;color:#ffffff;">
                                <p style=
                                " padding: 0; margin: 0 auto; max-width: 110px; text-align: center;font-size: 10px;">
                                    <span class="wrap_textbox">Mr. Sanjay
                                    Randhar</span></p>
                                    <p style=
                                    "padding:0; margin:0 auto;text-align: center !important; max-width:110px; font-size: 8px;">
                                    <span class="wrap_textbox">MD at
                                    GVFL</span></p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </table>

我试过的是,

<table style="width: 600px">
<tr>
    <td style="text-align: center">
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455797754.png" border="0" height="110" width="110" ></a>
        </span>
        
        
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455300140.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455299755.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455298163.jpeg" border="0" height="110" width="110" ></a>
        </span>
       
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455797754.png" border="0" height="110" width="110" ></a>
        </span>
    </td>
</tr>
</table>

但是没有相应图像的文字调整。

PS:我必须仅使用table内嵌css

谢谢。

2 个答案:

答案 0 :(得分:0)

嗯......一个解决方案是将它们全部放在同一行,并更改displaytable元素的td。因此它们的行为类似于blockinline-block元素。这样,您可以在每一行上设置4 td,即使所有8行都在同一行(使用HTML),也可以使用width:25%;display:inline-block

我写CSS是因为它对我来说更快更容易理解,但你可以复制CSS并将其用作内联CSS。

在我的示例中,我隐藏了带有文字td的第一个TITLE1,因此您可以看到第5个td(第一行在第二行,文字为TITLE5)第一行为第4行

让我知道它是否适合你

&#13;
&#13;
table { width:100%;display:block;text-align:center;}
table td { width:25%;display:inline-block;margin:0;padding:0;text-align:center;vertical-align: top;}
table td img { max-width:100%;}
table td span { word-break:break-word;}
td:first-child { display:none}
&#13;
<table>
<tr>
  <td><img src="http://placehold.it/350x150">
  TITLE1
  </td>
  <td><img src="http://placehold.it/350x150">
<span>TITLE2TITLE2TITLE2TITLE2TITLE2TITLE2TITLE2TITLE2</span>
  </td>
  <td><img src="http://placehold.it/350x150">
  TITLE3
  </td>
  <td><img src="http://placehold.it/350x150">
  TITLE4
  </td>
  <td><img src="http://placehold.it/350x150">
    TITLE5
  </td>
  <td><img src="http://placehold.it/350x150">
    TITLE6
  </td>
  <td><img src="http://placehold.it/350x150">
      TITLE7
</td>
<td><img src="http://placehold.it/350x150">
  TITLE8
     </td>
</tr>

</table>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

嗯......再次你的问题......无事可做,因为你正在使用一个固定宽度的桌子而且只有一个td ..使用javascript删除整个跨度..如果你删除第一行的图像,第一行第二行的图像将自动放置到第一行的最后一个位置。 用8张图片看我的第一个片段..

&#13;
&#13;
<table style="width: 600px">
<tr>
    <td style="text-align: center">
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455797754.png" border="0" height="110" width="110" ></a>
        </span>
        
        
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455300140.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455299755.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455298163.jpeg" border="0" height="110" width="110" ></a>
        </span>
       
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455797754.png" border="0" height="110" width="110" ></a>
        </span>
        
        
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455300140.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455299755.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455298163.jpeg" border="0" height="110" width="110" ></a>
        </span>
    </td>
</tr>
</table>
&#13;
&#13;
&#13;

删除第一行的第二张图片后检查我的第二个片段。

&#13;
&#13;
<table style="width: 600px">
<tr>
    <td style="text-align: center">
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455797754.png" border="0" height="110" width="110" ></a>
        </span>
        
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455299755.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455298163.jpeg" border="0" height="110" width="110" ></a>
        </span>
       
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455797754.png" border="0" height="110" width="110" ></a>
        </span>
        
        
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455300140.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455299755.jpeg" border="0" height="110" width="110" ></a>
        </span>
        <span style="display: inline-block;width: 116px;margin-left: 15px">
<a href="#"><img src="http://www.hubilo.com/eventApp/ws//images/speaker/profile/thumb/2712_1455298163.jpeg" border="0" height="110" width="110" ></a>
        </span>
    </td>
</tr>
</table>
&#13;
&#13;
&#13;