效果
index.html
<! DOCTYPE html >
< html lang = " en" > < head> < meta charset = " UTF-8" /> < meta http-equiv = " X-UA-Compatible" content = " IE=edge" /> < meta name = " viewport" content = " width=device-width,initial-scale=1.0" /> < title> Document </ title> < link type = " text/css" rel = " styleSheet" href = " index.css" /> </ head> < body> < div class = " container" > < button type = " button" > < span> 倾斜按钮</ span> </ button> </ div> </ body>
</ html>
index.css
button { width : 180px; height : 80px; background : #000; border : none; outline : none; display : block; margin : 0 auto; color : #fff; font-size : 18px; border-radius : 15px 0; position : relative; transform : skew ( -20deg) ;
}
button::before { content : '' ; position : absolute; width : 20px; height : 20px; background : radial-gradient ( circle at 0 0, transparent 0 20px, #000 5px) ; bottom : 0px; left : -20px;
}
button::after { content : '' ; position : absolute; width : 20px; height : 20px; background : radial-gradient ( circle at 100% 100%, transparent 0 20px, #000 5px) ; top : 0px; right : -20px;
} button span { display : block; transform : skew ( 20deg) ;
}