当前位置: 代码迷 >> Web前端 >> 给表单旋钮添加背景图片
  详细解决方案

给表单旋钮添加背景图片

热度:104   发布时间:2012-09-05 15:19:35.0
给表单按钮添加背景图片

闲着无聊就个写了一个关于button背景图片的demo,纯粹是写得好玩,希望大家不要见笑

?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script src="lib/jquery-1.6.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(
	function(){
	
	}
);

</script>
<style type="text/css">
#icon_center{
	background-image:url(img/save.gif);
	background-repeat :no-repeat;
	font-size:12px;
	color:#000099;
	padding-left:18px;
	width:52px;
	text-align:right;
}
</style>
<title>无标题文档</title>
</head>

<body>
	<input id="icon_center" icon='icon-save' type='button' value='保存' >
	background-image:url(img/save.gif);//设置按钮的背景图片<p>
	background-repeat :no-repeat;//北京图片不重复出现<p>
	font-size:12px;//按钮字体的大小为12px<p>
	color:#000099;//按钮字体的颜色为#000099<p>
	padding-left:18px;//左内补丁为18px<p>
	width:52px;//按钮的宽度为52px<p>
	text-align:right;//按钮显示的字体靠右对其<p>
</body>
</html>

?

备注:这里的CSS样式一定要和其他的属性一起配合,否则效果看不出来

?