Wednesday, June 14, 2017

How to create HTML button with rounded corners using HTML and CSS

How to create HTML button with rounded corners using HTML and CSS

Button With Rounded Corners

Change the button corner style as rounded using the border-radius property


Sample code: To Create HTML Button With Rounded Corners


<!DOCTYPE html>
<html>
<head>
<style>
    .button
    {
        background-color: orange;
        border: none;
        color: white;
        padding: 14px 28px;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 14px;
        margin: 4px 2px;
        cursor: pointer;
    }

    .button1 { border-radius: 4px; }
    .button2 { border-radius: 8px; }
    .button3 { border-radius: 12px; }
    .button4 { border-radius: 50%; }
</style>
</head>
<body>
    <h2>Button With Rounded Corners</h2>
    <p>Change the button corner style as rounded using the border-radius property</p>
    <button class="button button1">4px</button>
    <button class="button button2">8px</button>
    <button class="button button3">12px</button>
    <button class="button button4">50%</button>
</body>
</html>