CSS bg图像定位

时间:2012-07-20 23:21:27

标签: css html5 internet-explorer google-chrome css3

我有一个带有bg图像的div background-position:bottom right -3px;在Firefox中完美运行,但它在IE和CHROME中断了。如何在IE和CHROME中根据需要在DIV中定位我的图像?

以下是IE和FIREFOX

的屏幕截图

enter image description here

FIREFOX ^

enter image description here

IE ^

CSS

.side_msg { font-size:16px; text-align:left; color:#EFEFEF; background-color:#7B9F31;     padding:30px; border-top:2px solid #FFF; border-left:2px solid #FFF;     border-right:2px solid #FFF; margin-right:-80px;
 background-image:url(../img/msg_bot.png); background-position:bottom right -3px       !important; background-repeat:no-repeat;  }
.side_msg_top { position:relative; right:-80px; bottom:-12px; min-height:58px;      background-image:url(../img/msg_top.png); background-position:right; background-repeat:no-repeat; }

1 个答案:

答案 0 :(得分:3)

位置只能是两个坐标,所以:

background-position: right bottom;

或者:

background-position: right -3px;

或者:

background-position: -3px bottom;