我有一个图像横幅,我试图在其上添加一个按钮。该按钮采用HTML格式,而不是图像。但是,问题是我无法移动图像顶部的按钮。我相信它与按钮的边缘有关。我在Weebly网站上实现了以下代码,尽管该按钮似乎完全适合编辑器,但发布后,该按钮会显示在横幅底部。以下是我的HTML代码:按钮填充不起作用
“margin:-70px”似乎是正确的,尽管它在发布后并不适用。那么,怎么了?有什么遗漏吗?
.btn_action_1 {
border: 5px solid #000 !important;
/* Change button border color */
color: #000 !important;
/* Change button text color */
font-size: 22px;
font-family: 'Ubuntu';
line-height: 0;
display: inline-block;
padding: 10px 15px 10px;
position: relative;
text-decoration: none;
z-index: 3;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.btn_action_1 span {
left: 10px;
position: relative;
-o-transition: all .4s;
-moz-transition: all .4s;
-webkit-transition: all .4s;
transition: all .4s;
}
.btn_action_1 .ico_arrow {
background: url(ico_arrow_w.png) 0 center no-repeat;
display: inline-block;
height: 17px;
width: 17px;
position: relative;
left: -12px;
top: 0px;
opacity: 0;
filter: alpha(opacity=0);
-o-transition: all .4s;
-moz-transition: all .4s;
-webkit-transition: all .4s;
transition: all .4s;
}
.btn_action_1:hover {
background: #000 !important;
/* Change button background color when mouse over */
color: #fff !important;
/* Change button text color when mouse over */
}
.btn_action_1:hover span {
left: -5px;
}
.btn_action_1:hover .ico_arrow {
opacity: 1;
filter: alpha(opacity=100);
left: 5px;
}
@media (max-width: 479px) {
.btn_action_1 {
padding: 18px 30px;
}
}
.btn_action_1:not(:hover)>.hover,
.btn_action_1:hover>.default {
display: none
}
<img src="http://unlckpaypal.weebly.com/uploads/6/3/8/8/63884033/left_banner.png" style="margin: 10px 0px 0px 0px;width:440px;height:210px;">
<a href="http://unlckpaypal.weebly.com/trending-127809.html" style="margin:-70px 0px 0px 200px;width:180px;height:45px;" class="btn_action_1">
<span>SHOP NOW</span>
<i class="ico_arrow"></i>
</a>
我建议你放弃这种方法,并使用图像作为(说)一个div的背景,然后只需将按钮放在顶部。 – mayersdesign
我认为填充工作正常看到我在我的回答中添加了js小提琴 – user7357089
您是否可以显示您希望输出的图像? – Lucian