在HTML表格中添加图像 [英] Adding image inside table cell in HTML

查看:195
本文介绍了在HTML表格中添加图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,但我不能做这个简单的事情。我无法在表格单元格中添加图像。
下面是我写的代码: - $ /
$ b $ pre $ < html>
< head>汽车应用< / head>
< body>

< table border = 5 bordercolor = red align = center>
< th colspan = 14> ABCD< / th>
< tr>
< th colspan = 4>名称< / th>
< th colspan = 4> Origin< / th>
< th colspan = 4>照片< / th>
< / tr>
< tr>
< td colspan = 4>布加迪威龙超级运动< / th>
< td colspan = 4> Molsheim,法国阿尔萨斯< / th>
< td colspan = 4>< img src =C:\Pics\H.gifalt =border = 3 height = 100 width = 100>< / img>< TD>
< / tr>
< tr>
< td colspan = 4> SSC Ultimate Aero TT TopSpeed< / td>
< td colspan = 4>美国< / td>
< td colspan = 4 border = 3 height = 100 width = 100> Photo1< / td>
< / tr>
< tr>
< td colspan = 4> Koenigsegg CCX< / td>
< td colspan = 4>瑞典恩格尔霍尔姆< / td>
< td colspan = 4 border = 4 height = 100 width = 300> Photo1< / td>
< / tr>
< tr>
< td colspan = 4> Saleen S7< / td>
< td colspan = 4> Irvine,California,United States< / td>
< td colspan = 4 border = 3 height = 100 width = 100> Photo1< / td>
< / tr>
< tr>
< td colspan = 4>迈凯伦F1< / td>
< td colspan = 4>萨里,英格兰< / td>
< td colspan = 4 border = 3 height = 100 width = 100> Photo1< / td>
< / tr>
< tr>
< td colspan = 4>法拉利Enzo< / td>
< td colspan = 4>马拉内罗,意大利< / td>
< td colspan = 4 border = 3 height = 100 width = 100> Photo1< / td>
< / tr>
< tr>
< td colspan = 4>帕加尼Zonda F Clubsport< / td>
< td colspan = 4>摩德纳,意大利< / td>
< td colspan = 4 border = 3 height = 100 width = 100> Photo1< / td>
< / tr>
< / table>
< / body>
< html>

我做错了什么?这是我的输出屏幕: -



解决方案

这对我有用: - $ / $>
$ b

 <!DOCTYPE html> 
< html>
< head>
< title>汽车应用程式< / title>
< / head>
< body>
< center>
< h1> CAR APPLICATION< / h1>
< / center>

< table border =5bordercolor =redalign =center>
< tr>
< th colspan =3> ABCD< / th>
< / tr>
< tr>
< th>名称< / th>
< th> Origin< / th>
< th>照片< / th>
< / tr>
< tr>
< td>布加迪威龙超级运动< / th>
< td> Molsheim,法国阿尔萨斯< / th>
<! - 考虑到它位于.html文件所在的相同文件夹 - >
< td>< img src =。\A.jpegalt =border = 3 height = 100 width = 300>< / img>< / th>
< / tr>
< tr>
< td> SSC Ultimate Aero TT TopSpeed< / th>
< td>美国< / th>
< td border = 3 height = 100 width = 100> Photo1< / th>
< / tr>
< tr>
< td> Koenigsegg CCX< / th>
< td>瑞典恩格尔霍尔姆< / th>
< td border = 4 height = 100 width = 300> Photo1< / th>
< / tr>
< tr>
< td> Saleen S7< / th>
< td> Irvine,California,United States< / th>
< td border = 3 height = 100 width = 100> Photo1< / th>
< / tr>
< tr>
< td>迈凯轮F1第一赛段
< td>萨里,英格兰< / th>
< td border = 3 height = 100 width = 100> Photo1< / th>
< / tr>
< tr>
< td>法拉利Enzo< / th>
< td>马拉内罗,意大利< / th>
< td border = 3 height = 100 width = 100> Photo1< / th>
< / tr>
< tr>
< td>帕加尼Zonda F Clubsport< / th>
< td>意大利摩德纳< / th>
< td border = 3 height = 100 width = 100> Photo1< / th>
< / tr>
< / table>
< / body>
< html>


I am sorry but I am not able to do this simple thing. I am not able to add an image in the table cell. Below is my code which I have written:-

 <html>
   <head>CAR APPLICATION</head>
   <body>

    <table border = 5 bordercolor = red align = center>
    <th colspan = 14>ABCD</th>
    <tr>
        <th colspan = 4>Name</th>
        <th colspan = 4>Origin</th>
        <th colspan = 4>Photo</th>
    </tr>
    <tr>
        <td colspan = 4>Bugatti Veyron Super Sport</th>
        <td colspan = 4>Molsheim, Alsace, France</th>
        <td colspan = 4><img src="C:\Pics\H.gif" alt="" border=3 height=100 width=100></img></td>
    </tr>
    <tr>
        <td colspan = 4>SSC Ultimate Aero TT  TopSpeed</td>
        <td colspan = 4>United States</td>
        <td colspan = 4 border=3 height=100 width=100>Photo1</td>
    </tr>
    <tr>
        <td colspan = 4>Koenigsegg CCX</td>
        <td colspan = 4>Ängelholm, Sweden</td>
        <td colspan = 4 border=4 height=100 width=300>Photo1</td>
    </tr>
    <tr>
        <td colspan = 4>Saleen S7</td>
        <td colspan = 4>Irvine, California, United States</td>
        <td colspan = 4 border=3 height=100 width=100>Photo1</td>
    </tr>
    <tr>
        <td colspan = 4> McLaren F1</td>
        <td colspan = 4>Surrey, England</td>
        <td colspan = 4 border=3 height=100 width=100>Photo1</td>
    </tr>
    <tr>
        <td colspan = 4>Ferrari Enzo</td>
        <td colspan = 4>Maranello, Italy</td>
        <td colspan = 4 border=3 height=100 width=100>Photo1</td>
    </tr>
    <tr>
        <td colspan = 4> Pagani Zonda F Clubsport</td>
        <td colspan = 4>Modena, Italy</td>
        <td colspan = 4 border=3 height=100 width=100>Photo1</td>
    </tr>
</table>
 </body>
<html>

What I am doing wrong? This is my output screen:-

解决方案

This worked for me:-

 <!DOCTYPE html> 
  <html>
  <head>
<title>CAR APPLICATION</title>
 </head>
 <body>
<center>
    <h1>CAR APPLICATION</h1>
</center>

<table border="5" bordercolor="red" align="center">
    <tr>
        <th colspan="3">ABCD</th> 
    </tr>
    <tr>
        <th>Name</th>
        <th>Origin</th>
        <th>Photo</th>
    </tr>
    <tr>
        <td>Bugatti Veyron Super Sport</th>
        <td>Molsheim, Alsace, France</th>
                <!-- considering it is on the same folder that .html file -->
        <td><img src=".\A.jpeg" alt="" border=3 height=100 width=300></img></th>
    </tr>
    <tr>
        <td>SSC Ultimate Aero TT  TopSpeed</th>
        <td>United States</th>
        <td border=3 height=100 width=100>Photo1</th>
    </tr>
    <tr>
        <td>Koenigsegg CCX</th>
        <td>Ängelholm, Sweden</th>
        <td border=4 height=100 width=300>Photo1</th>
    </tr>
    <tr>
        <td>Saleen S7</th>
        <td>Irvine, California, United States</th>
        <td border=3 height=100 width=100>Photo1</th>
    </tr>
    <tr>
        <td> McLaren F1</th>
        <td>Surrey, England</th>
        <td border=3 height=100 width=100>Photo1</th>
    </tr>
    <tr>
        <td>Ferrari Enzo</th>
        <td>Maranello, Italy</th>
        <td border=3 height=100 width=100>Photo1</th>
    </tr>
    <tr>
        <td> Pagani Zonda F Clubsport</th>
        <td>Modena, Italy</th>
        <td border=3 height=100 width=100>Photo1</th>
    </tr>
</table>
  </body>
  <html>

这篇关于在HTML表格中添加图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆