在td或tr元素上创建透明div

时间:2009-07-01 17:57:05

标签: html css transparency

我有一张桌子,我希望能够在整行上设置一个透明的div,以表明它目前无法访问。

这是我表格中的一行:

<tr id="post_1998">
  <td id="post_1998_image">
    ...content...
  </td>
  <td class="description">
    ...more content...
  </td>
  <td class="buttons">
    ...even more content...
  </td>
</tr>

也许类似下面的内容可以设置透明度,但我不知道你将如何构建css。

<tr id="post_1998">
  <td id="post_1998_image">
    <div class="transparent">
    ...content...
    </div>
  </td>
  <td class="description">
    <div class="transparent">
    ...more content...
    </div>
  </td>
  <td class="buttons">
    <div class="transparent">
    ...even more content...
    </div>
  </td>
</tr>

谢谢!

3 个答案:

答案 0 :(得分:1)

您想在CSS中使用z-index值。使用适当的CCSS代码制作透明div,您可以使用Google搜索轻松找到它,然后将该div上的z-index设置为更高的值(例如20 - 随机选择)。这将div放在其他内容上。

您需要为不同的浏览器设置两种不同的设置才能实现透明度(来自内存)。

一些可能的帮助:

Coding Day - 使div透明

答案 1 :(得分:0)

您可以添加“透明”CSS类,然后您可以使用透明PNG或使用其他选项之一来获得透明度。 Here is an article谈论透明度。{/ p>

答案 2 :(得分:0)

创建一个空白的PNG图像,其透明度为1像素乘1像素(它几乎不占用任何资源)。

以下是CSS中透明div的示例:

#transparent
{
    position: absolute;
    z-index: 100;
    background-image: url('transparent_image.png');
    background-repeat: repeat;
}

你也必须给它一些尺寸(我确实放了任何尺寸,因为我不知道你的尺寸是什么,也不知道它在页面的位置)。

相关问题