【发布时间】:2010-04-11 10:58:16
【问题描述】:
我有一个简单的按钮(如下所示),我需要在该按钮上显示两张图片,一张在按钮文本的两侧。我正在努力创建适用于 Firefox 和 Internet Explorer 的 CSS! (按钮图像来自 JQuery UI 皮肤文件)
CSS
button div{
width:16px;
height:16px;
background-image: url(images/ui-icons_d19405_256x240.png);
}
button div.leftImage{
background-position: -96px -112px;
float: left;
}
button div.rightImage{
background-position: -64px -16px;
float: right;
}
HTML
<button><div class="leftImage"></div><span>Button Text</span><div class="rightImage"></div></button>
预览
火狐
Internet Explorer 8
【问题讨论】:
-
您在 html 中的类与 CSS 不同...
-
稍微描述一下实际问题......浏览器之间会发生什么不同?
-
我只是说这个例子没有意义。您在 CSS 中创建了“leftimage”和“rightimage”类,但在 html 中使用了“leftpic”和“rightpic”。
-
@Bruce:抱歉,div 类名已更正
-
@Gaby:请查看我发布的图片中的问题(和差异)。我希望我不是第一个尝试这个的人,有人可以发布他们成功的代码!