新闻中心

Success Stories

头条新闻

推荐内容

当前位置: 首页 > 新闻中心 > 建站知识

HTML图片按钮写法

时间:2012-08-07 20:48来源: 作者:admin 点击:
1: 在一般情况下按钮提交表单: form id=form1 name=form1 method=post action=index.html input type=submit name=button id=button value=提交 / /form 这样提交按钮是标签 input type=submit,如果想换成图片加上样式,把value=提交 改成value= (这样提

1: 在一般情况下按钮提交表单:

<form id="form1" name="form1" method="post" action="index.html">
<input type="submit" name="button" id="button" value="提交" />
</form>

这样提交按钮是标签 <input type="submit">,如果想换成图片加上样式,把value="提交" 改成value=" "(这样“提交”两个字就不会显示在这张背景图片的上面):

#button{
background:url(12.jpg) no-repeat;
width:100px;
height:50px;
border:0px;
cursor:pointer;
}
 

2:直接使用图片标签按钮

<form id="form1" name="form1" method="post" action="index.html">
<input name="submit" type="image" value="ee" src="12.jpg" />
</form>
 

这样子直接写在html页面上就能直接看到按钮是图片的!

 

3:由于上面第二种图片直接使用 “src”链接,但是如果一个网站很多需要到表单图片按钮展示的话,这样就会增加网页显示的速度!之前说过如果把全部类型差不多的图片整合成一张,每个页面使用css+div调用同一张图片里面的不同个按钮图标图片,这样的话便能更优化代码以及网站。

<form id="form1" name="form1" method="post" action="index.html">
<input name="submit" type="image" value="ee" src="12.jpg" />
</form>
样式:

button{
background:url(12.jpg) no-repeat -54px -35px;
width:100px;
height:50px;
border:0px;
cursor:pointer;
}

(责任编辑:admin)

顶一下
()
%
踩一下
()
%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
php语法报错,请【点击参考教程】 php语法报错,请【点击参考教程】
php语法报错,请【点击参考教程】
最新评论 进入详细评论页>>