<div>
<button class="button" type="primary">Primary</button>
<button class="button">Default</button>
<button class="button" type="dashed">Dashed</button>
<button class="button" type="text"><svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path d="M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"></path>
</svg>update</button>
</div>
html,body{
margin: 0;
height: 100%;
display: grid;
place-content: center;
}
:root{
--primary-color: royalblue;
}
.button{
padding: 5px 16px;
color: #000000d9;
border: 1px solid #d9d9d9;
background-color: transparent;
border-radius: 2px;
line-height: 1.4;
box-shadow: 0 2px #00000004;
cursor: pointer;
transition: .3s;
transform: scale(1);
}
.button:focus-visible{
outline: 0;
}
.button::after{
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
box-shadow: 0 0 0 6px var(--primary-color);
opacity: 0;
transition: .3s;
}
.button[type="primary"]{
border-color: transparent;
background-color: var(--primary-color);
color: #fff;
text-shadow: 0 -1px 0 rgb(0 0 0 / 12%);
box-shadow: 0 2px #0000000b;
}
.button[type="dashed"]{
border-style: dashed;
}
.button[type="text"]{
border-color: transparent;
box-shadow: none;
}
.button:not([type]):hover,
.button[type="dashed"]:hover,
.button[type="dashed"]:focus{
color: var(--primary-color);
border-color: currentColor;
}
.button[type="primary"]:hover{
filter: brightness(1.1);
}
.button[type="text"]:hover,
.button[type="text"]:focus{
background: rgba(0,0,0,.018);
}
.button.button:active{
filter: brightness(.9);
}
.button.button:active:not([type="text"])::after{
transition: 0s;
box-shadow: none;
opacity: 0.4;
}
.icon{
width: 1em;
margin-right: .5em;
vertical-align: middle;
fill: currentColor;
transform: rotate(360deg);
transition: .5s;
}
.button:active .icon{
transform: rotate(0);
transition: 0s;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.