box-shadow: 0 0 0px 5px #ff6600最里面的一层
,0 0 0px 15px #fff中间的白色
,0 0 0 20px #4fc1e9最外一层
;
css3多边框demo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| <!doctype html> <html> <head> <meta charset=utf-8> <title>HTML5 canvas demo</title> <style> *{ box-sizing:border-box; } .test{ height:100px;width:100px; border:0px solid #4fc1e9; border-radius:100%; transition:all .3s ease; display:flex; -webkit-justify-content: center; -webkit-align-items: center; } .test1{ padding:5px; } .test1:hover{ padding:0; border-width:5px; } .test3:hover{ -webkit-box-shadow: 0 0 0 5px #4fc1e9; -moz-box-shadow: 0 0 0 5px #4fc1e9; -ms-box-shadow: 0 0 0 5px #4fc1e9; -o-box-shadow: 0 0 0 5px #4fc1e9; box-shadow: 0 0 0px 5px #ff6600,0 0 0px 15px #fff,0 0 0 20px #4fc1e9; } .test4:hover{ -webkit-box-shadow: 0 0 0 5px #4fc1e9; -moz-box-shadow: 0 0 0 5px #4fc1e9; -ms-box-shadow: 0 0 0 5px #4fc1e9; -o-box-shadow: 0 0 0 5px #4fc1e9; box-shadow: 0 0 0 5px #ff6600 inset,0 0 0 10px #ffffff inset,0 0 0 15px #4fc1e9 inset; } </style> </head> <body> <div class='test test1'>内padding</div> <div class='test test3'>外box-shadow 双边效果</div> <div class='test test4'>内box-shadow 双边效果</div> </body> </html>
|