
w3.css
로딩 버튼
CSS를 사용하여 로딩 버튼을 만드는 방법을 알아보자.
로딩 버튼 스타일 지정 방법
1단계) HTML 추가
Font Awesome과 같은 아이콘 라이브러리를 추가하고 HTML 버튼에 아이콘을 추가한다.
<!-- Add icon library --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- Add font awesome icons to buttons (note that the fa-spin class rotates the icon) --> <button class="buttonload"> <i class="fa fa-spinner fa-spin"></i>Loading </button> <button class="buttonload"> <i class="fa fa-circle-o-notch fa-spin"></i>Loading </button> <button class="buttonload"> <i class="fa fa-refresh fa-spin"></i>Loading </button>
2단계) CSS 추가
/* Style buttons */ .buttonload { background-color: #04AA6D; /* Green background */ border: none; /* Remove borders */ color: white; /* White text */ padding: 12px 16px; /* Some padding */ font-size: 16px /* Set a font size */ }
기본 예시
예제 보기참고
W3C School - How TO - Loading Buttons