<div class="layout">
<!-- ここからボタンのHTML -->
<div class="button">
<a href="#">ボタン</a>
</div>
<!-- ここまでボタンのHTML -->
</div>
/* ここはレイアウトなのでボタンとは関係ない */
* {
margin: 0;
}
.layout {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
gap: 50px;
width: 100%;
height: 100vh;
}
/* ここからボタンのCSS */
.button {
a {
display: flex;
justify-content: center;
align-items: center;
width: 240px;
height: 50px;
font-size: 16px;
text-decoration: none;
background-color: #5cc0ef;
color: #fff;
border: 1px solid #5cc0ef;
transition: all 0.3s;
&:hover {
background-color: #fff;
color: #5cc0ef;
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.