我只想将背景图片放在表格的1个单元格中。当我在表格标记或“样式”中指定时,背景将应用于整个屏幕。是否可以仅使用html将不同的本地图像指定到表中的不同单元格?

相关HTML(摘自OP的评论):

<table align="center" height=501 border=2>
    <tr>
        <td height=167 align="center" style="background: (C:\Users\user\Desktop\4R9EF00Z.jpg);">[here]
      <a href="table9_1.html" target="_self"> Apple pie </a>s</td>
        <td rowspan=3 width="80%"> <b>Ingredients</b> .........</td>
    </tr>
</table>

最佳答案

<table style="width: 100%; height: 300px; ">
     <tr>
         <td style="background-image:url(http://www.housecatscentral.com/kittens.jpg)">CELL ONE</td>
         <td>CELL TWO</td>
    </tr>
</table>


应用样式的方法:


内联样式(通常不是首选方法)
类选择器
CSS2 / 3层次结构选择器或伪类
ID选择器

关于html - 背景图片,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8553638/

10-12 12:43
查看更多