Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 表rowspan透明图像_Image_Html Table_Png_Transparent - Fatal编程技术网

Image 表rowspan透明图像

Image 表rowspan透明图像,image,html-table,png,transparent,Image,Html Table,Png,Transparent,我的桌子有问题。我想在新闻稿的右上角有一个透明背景的图像。代码如下: <table> <tr> <td> <img src="header.png" alt="header" class="headerImg" /> </td> <td rowspan="3"> <img src="circle.png" alt="

我的桌子有问题。我想在新闻稿的右上角有一个透明背景的图像。代码如下:

<table>
    <tr>
        <td>
            <img src="header.png" alt="header" class="headerImg" />
        </td>
        <td rowspan="3">
            <img src="circle.png" alt="header" class="rightHeaderImg" />
        </td>
    </tr>
    <tr>   
        <td>
        </td>
        <td>
        </td>
    </tr>
    <tr>
        <td>
        </td>
        <td>
        </td>
    </tr>
</table>


问题似乎出在rowspan上,但我觉得奇怪的是,我有一个透明背景的.png图像,当它显示在td中时,它的背景颜色是纯色的。

如果你想让图像与它下面的行重叠,你可以通过让图像溢出
td
,不是通过给
td
一个行跨度

所以解决方案变成了这样

<table style="background:purple; border-spacing:0; height:112px">
  <tr>
    <td>top</td>
    <td>top</td>
    <td style="vertical-align:top">
      <div style="height:0;"><img src="circle.png" alt=""></div>
    </td>
  </tr>
  <tr style="background:#999">
    <td>bottom</td>
    <td>bottom</td>
    <td><!--empty--></td>
  </tr>
</table>

顶部
顶部
底部
底部
像这样

<table style="background:purple; border-spacing:0; height:112px">
  <tr>
    <td>top</td>
    <td>top</td>
    <td style="vertical-align:top">
      <div style="height:0;"><img src="circle.png" alt=""></div>
    </td>
  </tr>
  <tr style="background:#999">
    <td>bottom</td>
    <td>bottom</td>
    <td><!--empty--></td>
  </tr>
</table>

请注意,在带有图像的td内需要一个额外的
div
,否则td将垂直扩展到与图像一样高(即使将其高度显式设置为0,也无济于事)。还要注意的是,您需要为表格指定一个明确的高度,否则它将不知道容纳溢出图像所需的高度


好的,这就是我想要它做的:

<table border="1">
  <tr style="background:purple;">
    <td>top</td>
    <td>top</td>
    <td rowspan="2"><img src="circle.png" alt="header"/></td>
  </tr>
  <tr style="background:#999">
    <td>bottom</td>
    <!-- room for td above -->
    <td>bottom</td>
  </tr>
</table>

顶部
顶部
底部
底部
我希望圆形图像以某种方式使其td透明,以便紫色tr和灰色tr的颜色显示在图像后面。不应该使用divs og元素来解决这个问题


您能为我们提供CSS和附带的代码吗?也许是一杯鸡尾酒?我们不知道您提供的
es的代码是什么…表行中有哪种纯色?您能提供指向您站点的链接吗?如果问题出在某个特定的图像上,我们希望在提供解决方案之前先查看它。此外,您的选项卡没有右上角。既然您提到了时事通讯,您是在浏览器中观看还是通过电子邮件发送?此外,如果您在旧浏览器中进行测试,PNG可能无法工作(即6)。@unebune在这种情况下,我不知道我们是否能提供帮助。根据你现在提供的信息,我无法重现这个问题。