CSS3 border凹陷該如何編寫?
問題描述
本人新手,請問各位大神,如此,該如何編寫CSS3 ? (我說的是藍色的部分) 謝謝了~~
問題解答
回答1:我的思路:絕對定位+after/before偽類實現(xiàn),大致實現(xiàn)的效果如下:
TZ可以參見給的demo自行修改一下:在線demo
回答2:如果換個思路的話,可以把那個圓的margin設(shè)置成背景色,然后蓋住右側(cè),這樣看上去就像是凹進去的效果了。
回答3:首先更正一下一樓的答案,after/before是偽元素而不是偽類,這個很重要,不能把這個弄混淆了,如果是我我會用一個大圓覆蓋長條,再用小圓覆蓋大圓就好了
回答4:<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'><head> <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'> <title>css</title></head><body><style>#a { width: 150px; height: 300px; background: radial-gradient(circle at top left, transparent 15px, #e6e4b7 0) top left, radial-gradient(circle at top right, transparent 15px, #e6e4b7 0) top right, radial-gradient(circle at bottom right, transparent 15px, #e6e4b7 0) bottom right, radial-gradient(circle at bottom left, transparent 15px, #e6e4b7 0) bottom left; background-size: 50% 50%; background-repeat: no-repeat; padding: 20px 24px 22px 20px;}#b { display: block; background: radial-gradient(circle at top left, transparent 15px, red 0) top left, radial-gradient(circle at top right, transparent 15px, red 0) top right, radial-gradient(circle at bottom right, transparent 15px, red 0) bottom right, radial-gradient(circle at bottom left, transparent 15px, red 0) bottom left; background-size: 50% 50%; background-repeat: no-repeat; width:100%; height: 100%; padding: 2px;}#b:before { content: ''; width: 100%; height: 100%; display: block; background: radial-gradient(circle at top left, transparent 15px, #e6e4b7 0) top left, radial-gradient(circle at top right, transparent 15px, #e6e4b7 0) top right, radial-gradient(circle at bottom right, transparent 15px, #e6e4b7 0) bottom right, radial-gradient(circle at bottom left, transparent 15px, #e6e4b7 0) bottom left; background-size: 50% 50%; background-repeat: no-repeat;}</style> <p id='a'><p id='b'></p> </p></body></html>
相關(guān)文章:
1. javascript - JS中如何實現(xiàn) DIV內(nèi)部和鼠標的距離2. 雙擊安裝程序,安裝不了3. Python中使用超長的List導致內(nèi)存占用過大4. javascript - dropload+tab頁面,圖文頁滾動有兩個滾動區(qū)域怎么破?5. 文本處理 - 求教使用python庫提取pdf的方法?6. pdo - mysql 簡單注入疑問7. python - 如何用pandas處理分鐘數(shù)據(jù)變成小時線?8. windows-7 - Win7中Vmware Workstatoin與Xampp中Apache服務(wù)器端口沖突?9. html5 - 百度echart官網(wǎng)下載的地圖json數(shù)據(jù)亂碼10. 谷歌訪問助手安裝不了
