1
A
回答
5
.curveArea {
width: 500px;
height: 200px;
margin: 0 auto;
}
.mainBox {
height: 100%;
background: #fff;
overflow: hidden;
}
.curveSection {
width: 200%;
height: 100%;
border-radius: 50%;
background: #e44627;
top: 25%;
left: -50%;
right: 0;
position: relative;
border-top: 10px solid #fdedea;
}
<div class="curveArea">
<div class="mainBox">
<div class="curveSection"></div>
</div>
</div>
使用這一個,我希望這將是有益的
+0
你甚至可以使用一個psuedo元素,所以你沒有爲設計元素設置空的標記。 –
0
您將使用border-radius
但你需要做這樣的事情變得有點創意:一個比你的內容一個單獨的元素border-radius: 50%/2rem 2rem 0 0;
。
.container {
width: 100%;
overflow-x: hidden;
}
.my-cool-el {
background-color: #f00;
color: #fff;
margin-top: 2rem;
padding: 2rem 0;
position: relative;
text-align: center;
}
.my-cool-el:before {
background-color: #f00;
border-radius: 50%/2rem 2rem 0 0;
content:'';
display: block;
height: 2rem;
left: 0;
position: absolute;
top: -2rem;
width: 100%;
}
<div class="container">
<div class="my-cool-el">
Ready To Get Started
</div>
</div>
+0
自己試了一下,但正如你所看到的,極端(左/右)看起來並不像他們應該那樣彎曲。 – ronaldpoi
0
嘗試使用這樣的:
div{
border-radius:15px 100px 100px 5px;
background:#73AD21;
padding:20px;
width:200px;
height:150px;
}
2
您可以添加這個形狀pseudoelement去除需要額外的HTML塊
.curved-demo {
position: relative;
overflow: hidden;
/* just styles for demo */
font-family: Arial;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 100px;
padding-bottom: 100px;
color: #fff;
text-transform: uppercase;
font-size: 20px;
}
.curved-demo:before {
content: "";
display: block;
position: absolute;
left: -50%;
top: 0;
width: 200%;
bottom: 0;
background-color: #e44627;
border-top: 15px solid #fdedea;
border-radius: 50% 50% 0 0;
z-index: -1;
}
/* just styles for demo */
.curved-demo > button {
margin-top: 20px;
background-color: #000;
color: #fff;
padding: 10px 20px;
border: 0;
text-transform: inherit;
font-weight: bold;
border-radius: 3px;
font-size: inherit;
}
<div class="curved-demo">
Ready to get started
<button>Schedule a demo</button>
</div>
相關問題
- 1. 使用CSS創建曲線
- 2. 在XNA中創建曲線
- 3. 如何從直線創建曲線?
- 4. PHP + CSS + Lettering.js創建曲線文本
- 5. 如何創建一個曲面以創建曲線? (Matlab)
- 6. 如何創建CSS線
- 7. 在曲線盒內創建一個居中的曲線盒
- 8. 柔性容器css行線
- 9. 如何刪除HTML/CSS中的曲線
- 10. 如何使用cocos2d + Box2d在iphone上創建曲線線條?
- 11. 如何在手寫時創建線條的曲線
- 12. 如何在PHP中創建鐘形曲線圖
- 13. 如何在Android中創建曲線佈局?
- 14. 如何在android中創建曲線佈局
- 15. 如何在android中創建圓曲線矩形?
- 16. 如何在高圖中創建曲線下的高光區?
- 17. 如何在css中創建?
- 18. 創建分散曲線
- 19. CSS與曲線
- 20. 在創建CSS彎曲三角形弧
- 21. 如何計算線條和曲線的最近點? ..或曲線和曲線?
- 22. 如何使用CSS和JavaScript繪製正態分佈曲線(貝爾曲線)?
- 23. 扭曲和multiprocessing.Process如何創建殭屍?
- 24. 如何使用CSS和HTML創建曲面矩形(如圖中所示)?
- 25. CSS中的曲線菜單
- 26. CSS斜度在IE9中創建灰線
- 27. 如何創建最適合我地塊中點的曲線
- 28. 如何在兩條曲線之間創建漸變?
- 29. Css曲線頁腳
- 30. 使用唯一的CSS創建曲線格
什麼是你反對SVG?它可能可以滿足您的需求,特別是內聯svg? –