이미지 버튼 생성 방법
CSS를 사용하여 이미지에 버튼을 추가하는 방법을 배우세요.
이미지 버튼

이미지에 버튼 추가 방법
第一步 - HTML 추가:
<div class="container"> <img src="img_snow.jpg" alt="Snow"> <button class="btn">Button</button> </div>
第二步 - CSS 추가:
/* 버튼을 정위치시키기 위해 컨테이너가 필요합니다. 필요에 따라 너비를 조정하세요 */ .container { position: relative; width: 50%; {} /* 이미지가 반응형 레이아웃에 맞게 조정됨 */ .container img { width: 100%; height: auto; {} /* 버튼에 스타일을 설정하고, 그를 컨테이너/이미지의 중앙에 배치 */ .container .btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); background-color: #555; color: white; font-size: 16px; padding: 12px 24px; border: none; cursor: pointer; border-radius: 5px; {} .container .btn:hover { background-color: black; {}