我希望这对你来说应该很容易:) 我正在尝试制作三个带有重复背景图像的按钮。我使用两个<button>
和一个链接<a>
。它适用于链接,但不适用于按钮 - 侧面图像(圆角)不会出现。这是html:
<!doctype html>
<html>
<head>
<title>Task 1</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/reset/reset-min.css">
<link rel="stylesheet" type="text/css" href="task1.css">
</head>
<body>
<button class="blue-btn"><span id="left"> </span>OK<span id="right"> </span></button><br/>
<button class="blue-btn"><span id="left"> </span>Cancel<span id="right"> </span></button><br/>
<a href="#" class="blue-btn"><span id="left"> </span>View More Information<span id="right"> </span></a>
</body>
</html>
这是CSS:
.blue-btn{
background: url('button-repeat.png') repeat-x;
border:0;
height:55px;
font: 14px/44px Myriad-Pro, sans-serif;
color:black;
cursor:pointer;
}
a{
display:inline-block;
text-decoration:none;
}
#left{
display:block;
background: url('button-left.png') no-repeat;
height:55px;
width:24px;
float:left;
margin-left:-24px;
}
#right{
display:block;
background: url('button-right.png') no-repeat;
height:55px;
width:24px;
float:right;
margin-right:-24px;
}