html5 - css 這種六邊形的邊框怎么畫?
問題描述
用一個(gè)p+css怎么實(shí)現(xiàn)?
還這種可以填充顏色的
求代碼!
問題解答
回答1:<html> <head> <style> .sixedge{ height: 24px; width: 55px; position:relative; background-color: #FFF; border-top:1px solid green; border-bottom:1px solid green; margin-left:40%; } .sixedge:after{ content: ’’; position: absolute; background-color: transparent; top: 3px; right: -9px; width: 17px; height: 17px; transform: rotate(45deg); -ms-transform: rotate(45eg); -moz-transform: rotate(45deg); -webkit-transform: rotate(45deg); -o-transform: rotate(45deg); border-top: 1px solid green; border-right: 1px solid green; }.sixedge:before{ content: ’’; position: absolute; background-color: transparent; top: 3px; left: -9px; width: 17px; height: 17px; transform: rotate(45deg); -ms-transform: rotate(45eg); -moz-transform: rotate(45deg); -webkit-transform: rotate(45deg); -o-transform: rotate(45deg); border-bottom: 1px solid green; border-left: 1px solid green; } </style></head> <body> <p class='sixedge'>six</p> </body> </html>回答2:
最簡(jiǎn)單的是,拆分成左中右,三塊,2個(gè)三角形和一個(gè)矩形,然后合成,3個(gè)p
回答3:鏈接給你 自己畫吧
回答4:<p class='rectangle'>新手</p>.rectangle{
margin:0 auto;width:200px;height:51px;line-height:51px;text-align:center;position:relative;border-top:1px solid #00F;border-bottom:1px solid #00F;
}.rectangle:before{
content:'';position:absolute;top:7px;left:-19px;width:36px;border-top:1px solid #00F;height:36px;border-right:1px solid #00F;transform:rotate(-135deg);
}.rectangle:after{
content:'';position:absolute;top:7px;right:-19px;width:36px;border-top:1px solid #00F;height:36px;border-right:1px solid #00F;transform:rotate(45deg);
}
回答5:@machenchi0207 六邊形外框
借用 @machenchi0207 的代碼
回答6:CSS3漸變實(shí)現(xiàn)切角效果詳情見《css揭秘》第三章的切角效果
就是利用偽類 然后給大小為0, 邊框加上像素就是了,多試一下
相關(guān)文章:
1. javascript - jq 上傳圖片成功后添加一個(gè)新的上傳框時(shí)出現(xiàn)問題2. html5 - 最近在自學(xué)react 求一個(gè)react表單提交的例子3. 老師您好!我有一個(gè)問題、4. mysql - 千萬數(shù)據(jù) 分頁(yè),當(dāng)偏移量 原來越大時(shí),怎么優(yōu)化速度5. javascript - vscode alt+shift+f 格式化js代碼,通不過eslint的代碼風(fēng)格檢查怎么辦。。。6. python - angular route 與 django urls 沖突怎么解決?7. python django工程上傳一張照片調(diào)用python方法時(shí)報(bào)錯(cuò),請(qǐng)問如何處理?8. 我和老師的代碼對(duì)照了幾遍沒發(fā)現(xiàn)問題,但是瀏覽器打開就有問題了,求解9. 網(wǎng)站上有個(gè)圖標(biāo)改不了了 求幫忙 是用svg寫的10. python - Django ManyToManyField 字段數(shù)據(jù)在 admin后臺(tái) 顯示不正確,這是怎么回事?
