菜鳥救星網頁設計教學:按鈕Hover效果(下) 發佈日期: 2020-11-252020-11-18 作者: yijun 文、前端小編 設計網頁的時候要怎麼達到吸引使用者但又不太複雜的效果或特效呢?簡單的按鈕hover效果不只會豐富你的網頁,還會加強你的網頁設計感。下面就來一一介紹幾個簡單的按鈕hover效果吧!► 回顧 網頁設計教學:按鈕Hover效果(上) 七、文字zoom In/Out CSS .demo a.hover : before { opacity : 1; color : rgba(0,0,0,0.5); } .demo a.hover : after { background : rgba(255,255,255,0.9); transform : scale(1.5); } .demo a.hover : hover:before { opacity : 0; } .demo a.hover : hover:after { opacity : 1; transform : scale(1); } 結果如下 CSS .demo a.hover : after { background : rgba(255,255,255,0.9); transform : scale(0.1); } .demo a.hover : hover:before { opacity : 0; } .demo a.hover : hover:after { opacity : 1; transform : scale(1); } 結果如下 八、外框填滿 CSS .demo a.hover { display : inline-block; text-decoration : none; font-size : 18px; font-weight : bold; box-shadow : inset 0px 0px 0px 0px rgba(0, 0, 0, 0.5); border : solid 2px rgba(0, 0, 0, 0.5); padding : 6px 10px; margin : 10px; color : rgba(0, 0, 0, 0.5); position : relative; backface-visibility : hidden; transition : 0.3s; } .demo a.hover : before, .demo a.hover : after { display : none; } .demo a.hover : hover { box-shadow : inset 0px 0px 1px 20px rgba(0, 0, 0, 0.5); color : rgba(255,255,255,0.9); } 結果如下 九、邊框center背景填滿 CSS .demo a.hover { display : inline-block; text-decoration : none; font-size : 18px; font-weight : bold; border : solid 2px rgba(0, 0, 0, 0.5); padding : 6px 10px; margin : 10px; color : rgba(0, 0, 0, 0.5); position : relative; backface-visibility : hidden; transition : 0.3s; } .demo a.hover : before { color : rgba(0, 0, 0, 0.5); line-height : 200%; z-index : 2; } .demo a.hover : after { content : ‘ ’; width : 0; height : 100%; left : 50%; color : transparent; background : rgba(0, 0, 0, 0.5); z-index : 1; } .demo a.hover : hover:before { color : rgba(255,255,255,0.9); } .demo a.hover : hover:after { width : 100%; left : 0; } 結果如下 十、邊框center背景旋轉延伸 CSS .demo a.hover : after { content : ‘ ’; width : 0; height : 100%; left : 50%; color : transparent; background : rgba(0, 0, 0, 0.5); transform : skew(0deg); z-index : 1; } .demo a.hover : hover:before { color : rgba(255,255,255,0.9); } .demo a.hover : hover:after { width : 100%; left : 0; transform : skew(45deg); } 結果如下 十一、邊框Left/Right背景填滿 CSS .demo a.hover : after { content : ‘ ’; height : 100%; left : -100%; color : transparent; background : rgba(0, 0, 0, 0.5); z-index : 1; } .demo a.hover : hover:before { color : rgba(255,255,255,0.9); } .demo a.hover : hover:after { left : 0; } 結果如下 CSS .demo a.hover : after { content : ‘ ’; height : 100%; left : auto; right : 100%; color : transparent; background : rgba(0, 0, 0, 0.5); z-index : 1; } .demo a.hover : hover:before { color : rgba(255,255,255,0.9); } .demo a.hover : hover:after { right : 0; } 十二、邊框背景slide Up/Down CSS .demo a.hover : before { color : rgba(0, 0, 0, 0.5); } .demo a.hover : after { height : 100%; top : 100%; color : rgba(255, 255, 255, 0.9); background : rgba(0, 0, 0, 0.5); } .demo a.hover : hover:before { opacity : 0; } .demo a.hover : hover:after { top : 0; } 結果如下 CSS .demo a.hover : before { color : rgba(0, 0, 0, 0.5); } .demo a.hover : after { height : 100%; top : -100%; color : rgba(255, 255, 255, 0.9); background : rgba(0, 0, 0, 0.5); } .demo a.hover : hover:before { opacity : 0; } .demo a.hover : hover:after { top : 0; } 十三、邊框背景slide Left/Right CSS .demo a.hover : before { color : rgba(0, 0, 0, 0.5); } .demo a.hover : after { height : 100%; left : -100%; color : rgba(255, 255, 255, 0.9); background : rgba(0, 0, 0, 0.5); } .demo a.hover : hover:before { opacity : 0; } .demo a.hover : hover:after { left : 0; } 結果如下 CSS .demo a.hover : before { color : rgba(0, 0, 0, 0.5); } .demo a.hover : after { height : 100%; left : 100%; color : rgba(255, 255, 255, 0.9); background : rgba(0, 0, 0, 0.5); } .demo a.hover : hover:before { opacity : 0; } .demo a.hover : hover:after { left : 0; } 結果如下 文章來源參考 加入菜鳥救星官方Line並回覆「我想看文章」,不定期獲得更多知識吧! 不同頻道,不同知識! Facebook Instagram Youtube 分享此文: 分享到 X(在新視窗中開啟) X 分享到 Facebook(在新視窗中開啟) Facebook 分享到 Telegram(在新視窗中開啟) Telegram 以電子郵件將連結傳送給朋友(在新視窗中開啟) 電子郵件 請按讚:喜歡 正在載入... 相關