I am trying to create a button shaped like the below image, and I can't find any easy way to do it, nor does any of the libraries I have searched offers something like this, which is frankly surprising, as I would think that this is a rather common shape. Can anyone teach me how do I do this?
Asked
Active
Viewed 832 times
-1
-
1`border-radius:1em;`should be what you look for ;) – G-Cyrillus Jun 21 '20 at 20:35
-
Assuming you have a fixed height of n-pixels you simply set border-radius to n/2 pixels :) Cheers – RNH Jun 21 '20 at 20:38
-
In JavaScript? That doesn't make sense – Turnip Jun 21 '20 at 20:41
2 Answers
3
All you need is CSS using border-radius.
input[type="button"] {
padding: 10px 20px;
border-radius: 20px;
border: 1px solid red;
color: red;
background: transparent;
}
<input type="button" value="Previous" />
The black outline you might be seeing (when you click the button) is a Chrome feature which can be disabled. This is not something that (to my knowledge) can be fixed with outline-style: none;
. Read more about it here.

Peter
- 624
- 1
- 8
- 24
1
The CSS property you are looking for is border-radius
button {
border: 1px solid black;
border-radius: 15px;
padding: 10px 50px;
}
<button>Previous</button>

Toxnyc
- 1,350
- 7
- 20