我可以使用CSS在同一个元素上设置两个背景图片吗? [英] Can I set two background images on the same element with CSS?

查看:149
本文介绍了我可以使用CSS在同一个元素上设置两个背景图片吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例HTML代码:

<table>
<tr>
 <td class="a b">

示例CSS文件:

.a
{
  background-image:url(a.png);
}

.b
{
  background-image:url(b.png);
}

似乎b部分被忽略。

是否有任何方法可以在同一单元格中包含两个图像,即使使用其他技术?

Is there any way to inlclude both images in the same cell, even using other technique?

推荐答案

您可以这样做:

<td class="a"><div class="b">...</div></td>

然后 td ,并且其中的 div 将具有第二个。如果一个透明,另一个透明。我认为 b.png 将在顶部,但我不确定。

Then the td will have the first background, and the div inside it will have the second. If one is transparent, the other will show through. I think b.png will be on top, but I'm not sure about that.

这篇关于我可以使用CSS在同一个元素上设置两个背景图片吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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