創建在CSS 3
回答
看看css3屬性border-radius。它有x和y偏移顏色和模糊半徑的選項。在你的情況下,如果4px應該工作,灰色沒有偏移和模糊。
您可能只需將邊框設置爲淺色並勾勒出較暗的顏色,然後設置邊框半徑即可。注我沒有測試過,如果內存服務的輪廓不曲線與邊界半徑。另請注意,border-radius需要設置多個屬性才能兼容跨瀏覽器。有關更多信息,請參閱http://perishablepress.com/press/2008/11/24/perfect-rounded-corners-with-css/。
如果失敗,您可以隨時使用內部div,您設置爲絕對位置,左邊0,右邊0,頂部0和底部0,然後將其用作內邊框或外邊框。然後設置邊界半徑肯定會起作用。
問候, 理查德
哇從過去那裏閃現 –
倒票是怎麼回事?我的答案完全有效。投票時應該完全有理由給出一個理由。 – ClarkeyBoy
它只是用兩個盒子陰影,一個插圖和其他一開始,即:
.box {
width: 100px;
height: 100px;
box-shadow: 0 3px 6px rgba(0,0,0,0.3), inset 0 -3px 3px rgba(0,0,0,0.1);
border: solid #ccc 1px;
border-radius: 10px;
margin: 50px 0 0 50px;
}
更新:我已經刪除了供應商前綴,因爲幾乎所有的瀏覽器支持這些特性並不需要它們。放棄它們在這一點上被認爲是最佳做法。
看到
border-radius
和box-shadow
的Caniuse頁面。
做到這一點的最好的也是唯一的方法是使用多箱陰影:
element {
box-shadow: rgba(0,0,0,0.2) 0px 2px 3px, inset rgba(0,0,0,0.2) 0px -1px 2px;
border-radius: 20px;
}
box-shadow
是這樣工作的:
box-shadow: [direction (inset)] [color] [Horizontal Distance] [Vertical Distance] [size];
border-radius
是這樣工作的:
border-radius: [size];
/*or*/
border-radius: [topleft/bottomright size] [topright/bottomleft size];
/*or*/
border-radius: [topleft] [topright] [bottomright] [bottomleft];
您可以指定高度像這樣的曲線的長度:
border-radius: [tl-width] [tr-width] [br-width] [bl-width]/[tl-height] [tr-height] [br-height] [bl-height];
不要忘記'border-radius'! – joshnh
我有點晚了,但是,是的,使用邊界半徑和箱陰影(S),你應該是好去。
.block {
border-radius:6px;
box-shadow: inset 0px 0px 2px 2px #aaa, 3px 3px 5px 0px #eee;
}
嘗試在CSS中添加border-radius和text-shadow。
.box {
border-radius:20px;
text-shadow:2px 2px black;
}
希望這會有所幫助。
- 1. 用HTML 5和CSS 3創建「截圖」?
- 2. 我可以在CSS 3中創建一個Mac菜單嗎?
- 3. 在Rails 3中創建plist 3
- 4. 在Swift 3中創建UIToolbar
- 5. 創建CSS
- 6. 創建CSS
- 7. 創建CSS
- 8. 在CSS中創建背景
- 9. 的CSS:創建使用CSS
- 10. CSS:在(3)
- 11. 使用CSS創建
- 12. CSS - 創建子類
- 13. 用「PHP」創建「CSS」
- 14. 創建CSS菜單
- 15. 創建使用CSS
- 16. 創建CSS面板
- 17. 使用CSS創建
- 18. 創建HTML/JS/CSS
- 19. 如何創建CSS
- 20. 使用css創建div
- 21. W3.css如何在一行中創建?
- 22. 在Flex3 Air中創建和編輯CSS
- 23. CSS(3?):創建矩形中心明亮的背景
- 24. 創建不同的CSS層
- 25. 如何在css中創建三列
- 26. 如何在mouseover上創建javascript/css fadeInDown?
- 27. 在CSS/HTML創建六邊形
- 28. 在Spring 3中創建單一測試
- 29. 在YUI中創建文檔片段3
- 30. 如何在sqlite 3中創建表?
你爲什麼不接受答案?看起來很不錯。 – Mick