一款純css3實現(xiàn)的顏色漸變按鈕的代碼教程
發(fā)布時間:2014-11-12 10:48:53 作者:佚名
我要評論

今天給大家分享一款純css3實現(xiàn)的顏色漸變按鈕,這款按鈕的邊框和文字的顏色通過css3實現(xiàn)兩種顏色的漸變,清新淡雅,效果非常好看,需要的朋友可以參考下
之前為大家分享很多純css3實現(xiàn)的實用按鈕,今天給大家?guī)硪豢罴僣ss3實現(xiàn)的顏色漸變按鈕。這款按鈕的邊框和文字的顏色通過css3實現(xiàn)兩種顏色的漸變,效果非常好看,一起看下效果圖:
實現(xiàn)的代碼。
html代碼:
XML/HTML Code復制內容到剪貼板
- <div class="container">
- <a target="_blank" class="btn green" href="http://www.dbjr.com.cn/"><span>Nominate Yourself</span></a>
- <a target="_blank" class="btn orange" href="http://www.dbjr.com.cn/"><span>Nominate Someone</span></a>
- <a target="_blank" class="btn blue" href="http://www.dbjr.com.cn/"><span>Buy Tickets Now</span></a>
- </div>
css3代碼:
CSS Code復制內容到剪貼板
- .btn
- {
- display: inline-block;
- margin: 1em 0;
- padding: 1em 2em;
- background: transparent;
- border: 2px;
- border-radius: 3px;
- font-weight: 400;
- text-align: center;
- }
- .btn.green
- {
- box-shadow: 0 1px 0 1px rgba(43, 220, 146, 0.25), 0 -1px 0 1px rgba(129, 214, 106, 0.25), 1px 0 0 1px rgba(43, 220, 146, 0.25), -1px 0 0 1px rgba(129, 214, 106, 0.25), 1px -1px 0 1px rgba(86, 217, 126, 0.5), -1px 1px 0 1px rgba(86, 217, 126, 0.5), 1px 1px 0 1px rgba(0, 223, 166, 0.75), -1px -1px 0 1px rgba(173, 211, 86, 0.75);
- }
- .btn.green span
- {
- background: -webkit-linear-gradient(left, #add356, #00dfa6);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- .btn.orange
- {
- box-shadow: 0 1px 0 1px rgba(255, 102, 43, 0.25), 0 -1px 0 1px rgba(255, 169, 69, 0.25), 1px 0 0 1px rgba(255, 102, 43, 0.25), -1px 0 0 1px rgba(255, 169, 69, 0.25), 1px -1px 0 1px rgba(255, 136, 56, 0.5), -1px 1px 0 1px rgba(255, 136, 56, 0.5), 1px 1px 0 1px rgba(255, 69, 31, 0.75), -1px -1px 0 1px rgba(255, 203, 82, 0.75);
- }
- .btn.orange span
- {
- background: -webkit-linear-gradient(left, #ffcb52, #ff451f);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- .btn.blue
- {
- -webkit-border-image: -webkit-linear-gradient(left, #3dade9, #bf2fcb) round;
- border-image-slice: 1;
- }
- .btn.blue span
- {
- background: -webkit-linear-gradient(left, #3dade9, #bf2fcb);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- .btn:nth-of-type(1)
- {
- float: left;
- }
- .btn:nth-of-type(2)
- {
- float: rightright;
- }
- .btn:nth-of-type(3)
- {
- width: 100%;
- clear: left;
- padding: .75em;
- font-size: 3em;
- font-weight: 100;
- line-height: 1;
- letter-spacing: 1px;
- }
- *
- {
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- body
- {
- font: normal 1em 'Helvetica Neue' , Helvetica, sans-serif;
- background: #1d2025;
- -webkit-font-smoothing: antialiased;
- text-rendering: optimizeLegibility;
- }
- .container
- {
- width: 60%;
- margin: auto;
- position: absolute;
- top: 50%;
- left: 50%;
- -webkit-transform: translate(-50%, -50%);
- -ms-transform: translate(-50%, -50%);
- transform: translate(-50%, -50%);
- }
- .container:after
- {
- display: table;
- content: '';
- clear: both;
- }
- a
- {
- color: inherit;
- text-decoration: none;
- }
- h1.method1
- {
- background: -webkit-linear-gradient(left, #ef0, #f00);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
以上就是今天給大家?guī)硪豢罴僣ss3實現(xiàn)的顏色漸變按鈕的代碼,是不是很漂亮,謝謝閱讀,希望能幫到大家,請繼續(xù)關注腳本之家,我們會努力分享更多優(yōu)秀的文章。
相關文章
- 這篇文章主要介紹了使用CSS3實現(xiàn)字體顏色漸變的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習2020-08-10