本篇文章主要介绍如何做到不用图片用css实现按钮的美化,感兴趣的小伙伴参考一下。
代码如下:
<html>
<style>
.tb{width:100%;height:1px;overflow:hidden;background:rgb(250,100,0);margin:0 1px;}
.lr{width:100%;height:20px;overflow:hidden;border-left:1px solid rgb(250,100,0);border-right:1px
solid rgb(250,100,0);}
.bg{width:100%;height:20px;overflow:hidden;}
.button{position:relative;width:100%;height:20px;top:-20px;font-
size:9pt;border:0;background:none;}
</style>
<div style="float:left;width:100;">
<div class=tb></div>
<div class=lr>
<div class=bg id=bg></div>
<input class=button id=button type=button value="美化了的按钮">
</div>
<div class=tb></div>
</div>
<script>
function rgb(){
ID=arguments[0]
oRGB=eval(arguments[1])
nRGB=eval(arguments[2])
var IMG=""
for(i=20;i>0;i=i-2){
RGB="rgb("+(oRGB[0]-1)+","+(oRGB[1]-1)+","+(oRGB[2]-1)+")"
IMG+="<img style=\"width:100%;height:1px;background:"+RGB+"\">"
}
for(i=20;i>0;i=i-2){
RGB="rgb("+(nRGB[0]-1)+","+(nRGB[1]-1)+","+(nRGB[2]-1)+")"
IMG+="<img style=\"width:100%;height:1px;background:"+RGB+"\">"
}
eval(ID+".innerHTML=IMG")
}
rgb("bg",[255,180,20],[255,140,20])
button.onmouseover=function(){rgb("bg",[255,200,20],[255,160,20])}
button.onmouseout=function(){rgb("bg",[255,180,20],[255,140,20])}
</script>相关推荐:
立即学习“前端免费学习笔记(深入)”;
以上就是如何做到不用图片用css实现按钮的美化的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号