css3 使用box-shadow實現(xiàn)浮雕風格按鈕效果
發(fā)布時間:2024-08-19 17:05:11 作者:hackchen
我要評論

這篇文章主要介紹了css3 使用box-shadow實現(xiàn)浮雕風格按鈕效果,本文通過實例代碼給大家介紹的非常詳細,感興趣的朋友跟隨小編一起看看吧
利用 box-shadow 實現(xiàn)浮雕風格的按鈕。
HTML:
<form> <div class="segment"> <h1>Sign up</h1> </div> <label> <input type="text" placeholder="Email Address" /> </label> <label> <input type="password" placeholder="Password" /> </label> <button class="red" type="button"><i class="icon ion-md-lock"></i> Log in</button> <div class="segment"> <button class="unit" type="button"><i class="icon ion-md-arrow-back"></i></button> <button class="unit" type="button"><i class="icon ion-md-bookmark"></i></button> <button class="unit" type="button"><i class="icon ion-md-settings"></i></button> </div> <div class="input-group"> <label> <input type="text" placeholder="Email Address" /> </label> <button class="unit" type="button"><i class="icon ion-md-search"></i></button> </div> </form>
SCSS:
$ruler: 16px; $color-red: #ae1100; $color-bg: #ebecf0; $color-shadow: #babecc; $color-white: #fff; body, html { background-color: $color-bg; } h1 { margin: 0; } body, p, input, select, textarea, button { font-family: "Montserrat", sans-serif; letter-spacing: -0.2px; font-size: $ruler; } div, p { color: $color-shadow; text-shadow: 1px 1px 1px $color-white; } form { padding: $ruler; width: $ruler * 20; margin: 0 auto; } .segment { padding: $ruler * 2 0; text-align: center; } button, input { border: 0; outline: 0; font-size: $ruler; border-radius: $ruler * 20; padding: $ruler; background-color: $color-bg; text-shadow: 1px 1px 0 $color-white; } label { display: block; margin-bottom: $ruler * 1.5; width: 100%; } input { margin-right: $ruler/2; box-shadow: inset 2px 2px 5px $color-shadow, inset -5px -5px 10px $color-white; width: 100%; box-sizing: border-box; transition: all 0.2s ease-in-out; appearance: none; -webkit-appearance: none; &:focus { box-shadow: inset 1px 1px 2px $color-shadow, inset -1px -1px 2px $color-white; } } button { color: #61677c; font-weight: bold; box-shadow: -5px -5px 20px $color-white, 5px 5px 20px $color-shadow; transition: all 0.2s ease-in-out; cursor: pointer; font-weight: 600; &:hover { box-shadow: -2px -2px 5px $color-white, 2px 2px 5px $color-shadow; } &:active { box-shadow: inset 1px 1px 2px $color-shadow, inset -1px -1px 2px $color-white; } .icon { margin-right: $ruler/2; } &.unit { border-radius: $ruler/2; line-height: 0; width: $ruler * 3; height: $ruler * 3; display: inline-flex; justify-content: center; align-items: center; margin: 0 $ruler/2; font-size: $ruler * 1.2; .icon { margin-right: 0; } } &.red { display: block; width: 100%; color: $color-red; } } .input-group { display: flex; align-items: center; justify-content: flex-start; label { margin: 0; flex: 1; } }
到此這篇關(guān)于css3 box-shadow 浮雕風格按鈕的文章就介紹到這了,更多相關(guān)css3 box-shadow浮雕按鈕內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
CSS3 最強二維布局系統(tǒng)之Grid 網(wǎng)格布局
CS3的Grid網(wǎng)格布局是目前最強的二維布局系統(tǒng),可以同時對列和行進行處理,將網(wǎng)頁劃分成一個個網(wǎng)格,可以任意組合不同的網(wǎng)格,做出各種各樣的布局,本文介紹CSS3 最強二維布局系2025-02-27- 本文介紹了如何使用CSS3的transform屬性和動畫技巧實現(xiàn)波浪式圖片墻,通過設(shè)置圖片的垂直偏移量,并使用動畫使其周期性地改變位置,可以創(chuàng)建出動態(tài)且具有波浪效果的圖片墻,同2025-02-27
CSS3模擬實現(xiàn)一個雷達探測掃描動畫特效(最新推薦)
文章介紹了如何使用CSS3實現(xiàn)一個雷達探測掃描的效果,包括夜色背景、蜘蛛網(wǎng)盤、掃描體的轉(zhuǎn)動效果、尾巴陰影以及被掃描到的光點,通過HTML和CSS的配合,實現(xiàn)了豐富的動畫效果,2025-02-21- CSS3的Flexbox是一種強大的布局模式,通過設(shè)置display:flex可以輕松實現(xiàn)對齊、排列和分布網(wǎng)頁元素,它解決了傳統(tǒng)布局方法中的對齊、間距分配和自適應布局等問題,接下來通過本2025-02-19
css3 實現(xiàn)icon刷新轉(zhuǎn)動效果
本文給大家介紹css3 實現(xiàn)icon刷新轉(zhuǎn)動效果,文章開頭給大家介紹了webkit-transform、animation、@keyframes這三個屬性,結(jié)合實例代碼給大家介紹的非常詳細,感興趣的朋友一2025-02-19- CSS3過渡屬性用于實現(xiàn)元素從一種樣式平滑過渡到另一種樣式,通過設(shè)置transition-property過渡屬性、transition-duration過渡時長transition-timing-function過渡函數(shù)和trans2025-02-19
CSS3實現(xiàn)動態(tài)旋轉(zhuǎn)加載樣式的示例代碼
本文介紹了如何使用CSS3創(chuàng)建一個簡單的動態(tài)旋轉(zhuǎn)加載樣式,通過定義一個帶有類名“l(fā)oader”的HTML元素,并使用CSS樣式和@keyframes規(guī)則來實現(xiàn)旋轉(zhuǎn)動畫,你可以根據(jù)需要調(diào)整樣式2025-02-19- 這篇文章主要介紹了如何使用CSS3的transition屬性實現(xiàn)平滑的過渡動畫,本文通過實例代碼給大家介紹的非常詳細,感興趣的朋友一起看看吧2025-02-13
CSS3中使用flex和grid實現(xiàn)等高元素布局的示例代碼
本文介紹了使用CSS3中的Flexbox和Grid布局實現(xiàn)等高元素布局的方法,通過簡單的兩列實現(xiàn)、每行放置3列以及全部代碼的展示,展示了這兩種布局方式的實現(xiàn)細節(jié)和效果,感興趣的朋2025-02-11- CSS3和SVG的結(jié)合使用為網(wǎng)頁設(shè)計帶來了創(chuàng)新的動態(tài)視覺效果,本文通過一個圓形進度條的動畫特效示例,展示了如何利用CSS3的動畫功能和SVG的矢量圖形能力來創(chuàng)建豐富的用戶交互體2024-10-24