我的Css如下所示我尝试将“+”图标向右移动一点但未能移动它,任何人都可以帮忙吗?
.button-sec-icon {
background-color: #fdfdfd;
cursor:pointer;
background: transparent url("images/basicsetup/plus.png") no-repeat left!important;
margin-right: 5px;
border: 2px solid #EEEEEE;
border-radius: 5px 5px 5px 5px;
box-shadow: 0 3px 1px rgba(0, 0, 0, 0.2);
color: #ca2b2b;
display: block;
height: 28px;
margin: 10px 0 0 60px;
transition: all 0.5s ease 0s;
min-width: 150px;
width: 121px;
}
.button-sec-icon:hover {
border :1px solid #888;
box-shadow: 0 4px 1px rgba(0, 0, 0, 0.2);
}
答案 0 :(得分:2)
您需要使用background-position
background: transparent url("images/basicsetup/plus.png") no-repeat left!important;
因此,不要使用left
,而是使用
background-position: 10px 0; /* Parameters are X and Y respectively */
答案 1 :(得分:1)
您可以将背景位置设置为右上角吗?
background: transparent url("images/basicsetup/plus.png") top right no-repeat !important;
或者即使您需要它,也可以使用百分比或固定宽度:
background: transparent url("images/basicsetup/plus.png") 0 5% no-repeat !important;
background: transparent url("images/basicsetup/plus.png") 0 5px no-repeat !important;
答案 2 :(得分:0)
background-position: 10px 0px;
这应该可以解决问题,背景位置可以在很多方面使用。 请阅读:
答案 3 :(得分:0)
您使用了两次保证金标签。 “保证金权利”和“保证金”。删除第一个“保证金权利”,看看会发生什么。