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:
最簡單的是,拆分成左中右,三塊,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. node.js - mongodb查找子對象的名稱為某個(gè)值的對象的方法2. javascript - QQ第三方登錄的問題3. 測試自動化html元素選擇器元素ID或DataAttribute [關(guān)閉]4. 運(yùn)行python程序時(shí)出現(xiàn)“應(yīng)用程序發(fā)生異常”的內(nèi)存錯(cuò)誤?5. spring-mvc - spring-session-redis HttpSessionListener失效6. 在mac下出現(xiàn)了兩個(gè)docker環(huán)境7. 利用IPMI遠(yuǎn)程安裝centos報(bào)錯(cuò)!8. mysql - 查詢 修改數(shù)據(jù)庫優(yōu)化問題吧9. 正在使用electron和node.js做桌面應(yīng)用,需要實(shí)時(shí)監(jiān)聽是否有網(wǎng)絡(luò)連接,node或者electron是否可以做到10. java - Spring boot 讀取 放在 jar 包外的,log4j 配置文件,系統(tǒng)有創(chuàng)建日志文件,不寫入日志信息。

網(wǎng)公網(wǎng)安備