你好,我们正在使用CSS3。如何在背景颜色上放置图像?
我们有一个TD标签,它的背景颜色设置为红色。
我们正在寻找一种方式,让我们可以放置一个以红色背景为中心的图像。红色背景和居中图像都必须在td标签内可见。
背景和图像必须在TD标签内嵌样式指定..
你好,我们正在使用CSS3。如何在背景颜色上放置图像?
我们有一个TD标签,它的背景颜色设置为红色。
我们正在寻找一种方式,让我们可以放置一个以红色背景为中心的图像。红色背景和居中图像都必须在td标签内可见。
背景和图像必须在TD标签内嵌样式指定..
HTML:
<td style="background: red url(http://lorempixel.com/output/nature-q-c-50-50-9.jpg) center no-repeat"></td>
Background财产文档。
red
background-color
套url(...)
组图像center
组图像原点到中心no-repeat
禁用图像重复使用的background属性,我们可以做到这一点
尝试以下
background: url("image path") no-repeat scroll center center #FF0000;
它的工作正常。 – KunJ
如果你想显示的背景颜色以及宽度和高度添加到您的td标签和背景大小的图像像下面的CSS一样。
width: 200px;
height: 200px;
background-color: red;
background-image: url('http://i.stack.imgur.com/i7woY.png?s=128&g=1');
background-position: center center;
background-repeat: no-repeat;
background-size: 100px 100px;
plz分享html和css代码..? – Neha