Maintain Perfectly Circular Corners on Variable-Height Element

前端 未结 1 1973
粉色の甜心
粉色の甜心 2021-01-12 02:51

I have a button with perfectly rounded corners; meaning, the button is 50px high and the border radius is 25px, making a perfect half-circle on either side of the button:

相关标签:
1条回答
  • 2021-01-12 03:21

    Just set the border-radius to something high, like 360px.

    div {
        height:50px;
        width:500px;
        background:red;
        border-radius:360px;
    }
    

    Look at this jsFiddle example to see what I mean.

    0 讨论(0)
提交回复
热议问题