我曾经使用过输入类型提交,但现在我想将其更改为按钮样式。为此,我使用了以下代码:
<div class="cartbutton">
<input type="submit" name="shortname" value="product1" class="add_to_cart" />
<div class="buttoninner">
<div class="buttontext">Add to Cart</div><div class="cartimage"></div>
</div>
</div>
我buttoninner
使用下面的 CSS 将 div 元素定位在 input-type 提交之上:
.cartbutton {
position: relative;
width: 178px;
}
.add_to_cart {
background: none repeat scroll 0 0 transparent;
border: 0 none;
cursor: pointer;
height: 38px;
opacity: 0;
width: 177px;
z-index: 2;
}
.buttontext {
background-color: #333333;
border: 0 none;
color: white;
cursor: pointer;
float: left;
font-family: "Segoe UI",helvetica,arial,sans-serif;
font-size: 20px;
padding: 5px 20px;
}
.cartimage {
background-color: #F7941D;
background-image: url("/Content/en-US/Sales/Images/small_cart.png");
background-position: 5px 50%;
background-repeat: no-repeat;
float: left;
height: 38px;
width: 40px;
}
.buttoninner {
position: absolute;
top: 0;
z-index: 1;
}
不幸的是,按钮帖子不起作用。如何激活 div 元素后面的提交按钮?