CSS를 사용하여 버튼을 세로 및 가로 가운데에 맞추려면 코드는 다음과 같습니다. -
예시
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.centered {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
border: 3px solid rgb(0, 70, 128);
}
button{
font-size: 18px;
border: none;
padding:10px;
background-color: darkblue;
color:white;
}
</style>
</head>
<body>
<h1>Centering Example</h1>
<div class="centered">
<button>This button is centered</button>
</div>
</body>
</html> 출력
위의 코드는 다음 출력을 생성합니다 -
