我尝试用图像和文本一起制作表单的提交按钮。我尝试了几种方法,但我遇到了问题。HTML:
<form action="www.page.html" method="post">
some text
<span>Check The Page</span>
<input type="image" src="check.png" name="Check" alt="Check" width="161" height="30">
CSS:
#reservation span{
display: inline-block;
z-index: 100;
}
#reservation input{
margin-top: -30px;
z-index: -100;
}
问题,z-index 不起作用。图片高于文字。如果我用 div 元素做其他方式。HTML:
<form action="www.page.html" method="post">
some text
<input type="submit" id="image-button" >Check The Page</input>
<div class="check">
<input type="image" src="check.png" name="Check" >
<span>Check</span>
</div>
CSS:
.check {
margin-left: 10px;
position: relative;
width: 100%; /* for IE 6 */
}
.check span {
position: absolute;
left: 0;
margin-top: 5px;
margin-left: 10px;
color: #ffffff;
font-family: Calibri;
font-size: 16px;
font-weight: bold;
font-style: italic;
text-shadow: #222222 1px 1px 0;
width: 100%;
}
然后图像和文本看起来不错,但是只有按钮的侧面用作表单的链接,而按钮的中间是文本层。有什么帮助吗?:)