角丸ボタン

表示デモ

実装コード

HTML

<div class="demo-wrap">
    <button class="btn basic color_change trans-y_change radius-s">Button Sample</button>
</div>

CSS

@charset "utf-8";

/* サイト共通設定 */
:root{
    --primary-color: #03588C;
    --primaty-opacity-color: 0.8;
}
html{
    font-size: 62.5%;
}
.demo-wrap {
    display: flex;
    justify-ßontent: center;
    padding: 50px;
}
/* ボタン共通設定 */
.btn {
    display:inline-block;
    padding: 12px 30px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    border: 0;
    font-size: 1.6rem;
    text-decoration: none;
    color: #ffffff;
    transition: all .25s ease;
    -webkit-tap-highlight-color: transparent;
}
.basic {
    background: var(--primary-color);
}
.radius-s {
    border-radius: 10px;
}
/* 変化 */
.color_change:hover, .color_change:focus {
    background: var(--primary-accent-color);
}
.trans-y_change:hover, .trans-y_change:focus {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(43,140,255,0.12);
}

ポイント

角を丸くする<border-radius>を追加するだけ!
<border-radius>が同じ値でも、ボタンのサイズ次第で角の丸みが変わる点に注意。

参考リンク