HTML不会显示2张图片

时间:2017-12-04 11:30:39

标签: html

我想在同一行显示2个图像,如下所示:

Image  Same Text  Image

如果我放一张图片就可以了,但是如果我把两张图片都放了,我会得到404。 我觉得我在代码中做错了,我对HTML没有多少经验,也不知道我缺少什么。 这些文件位于同一文件夹中。 这是代码:

<td colspan="8" >
<h1>
<img src="/home/apps/myapp/dynamic/img/myimage1.png" style="float:left; " alt="This is my mage" height="130" width="455">
<b>Same text</b>
<img src="/home/apps/myapp/dynamic/img/myimage2.png" style="float:right; vertical-align:middle;" alt="My second image" height="130" width="454"></h1>
</td>

3 个答案:

答案 0 :(得分:3)

只需你可以使用bootstrap .. 使用col-md-6将页面分成两半并将数据放入其各自的div中

   <div class="container">
    <div class="row">
     <div class="col-md-6">
      <img src="/path1">
     </div>
    <div class="col-md-6">
     <img src="/path2">
    </div>
   </div>
  </div>

答案 1 :(得分:0)

您的代码中有一个额外的开始标记,它会给出错误。

问题:

<<img src="/home/apps/myapp/dynamic/img/myimage2.png" 
style="float:right; vertical-align:middle;" alt="My second image" 
height="130" width="454"></h1>

解决方案

<img src="/home/apps/myapp/dynamic/img/myimage2.png" 
style="float:right; vertical-align:middle;" alt="My second image" 
height="130" width="454"></h1>

答案 2 :(得分:-1)

您可以通过创建嵌套表来完成。

<td>
  <table width="100%">
    <tr>
      <td>Image 1</td>
      <td>Text</td>
      <td>Image 2</td>
    </tr>
  </table>
</td>

或者您可以使用div属性创建float。将image1和text发送到float:left;,将image2发送到float:right