html+css3自定义button样式

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/nzzl54/article/details/84970500

原生的按钮有点丑,为此需要改装一下样式,达到适应页面或者美化的作用,下面的连接是用input做按钮和button做按钮的区别,有兴趣的可以看看。

https://blog.csdn.net/u010458114/article/details/79371304

先上效果图:

html+CSS实现如下:

<!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=utf-8" />
<title>按钮</title>
<style>
    .yongyin {
     width:100px;
     text-align:center;
     line-height:100%;
     padding:0.3em;
     font:16px Arial,sans-serif bold;
     font-style:normal;
     text-decoration:none;
     margin:2px;
     vertical-align:text-bottom;
     zoom:1;
     outline:none;
     font-size-adjust:none;
     font-stretch:normal;
     border-radius:50px;
     box-shadow:0px 1px 2px rgba(0,0,0,0.2);
     text-shadow:0px 1px 1px rgba(0,0,0,0.3);
     color:#fefee9;
     border:0.2px solid #2299ff;
     background-repeat:repeat;
     background-size:auto;
     background-origin:padding-box;
     background-clip:padding-box;
     background-color:#3399ff;
     background: linear-gradient(to bottom, #eeeff9 0%,#3399ff 100%);
}

.yongyin:hover {
    background: #268DFF;
}
</style>
</head>
<body>
<div style="margin-top:10px">
<button type="button" class="yongyin" onclick="alert('ceshi-custom')" style="width:100px; height:30px;">样式按钮</button>
</div>

</body>
</html>

这里的样式也不是很复杂,就是圆角、去掉原来的边框、做效果过度等。

最后记录一个问题:字符串相加问题

var a = "1",b = 9 ;

alert(a+b);  // 这个得到的是19

alert(eval(a)+b);  //这个得到的是10 

猜你喜欢

转载自blog.csdn.net/nzzl54/article/details/84970500