
w3.css
소셜 미디어 버튼
CSS를 사용하여 소셜 미디어 버튼의 스타일을 지정하는 방법을 알아보자.
소셜 미디어 버튼 스타일링 방법
1단계) 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 --> <a href="#" class="fa fa-facebook"></a> <a href="#" class="fa fa-twitter"></a> ...
2단계) CSS 추가 – 정사각형 버튼
/* Style all font awesome icons */ .fa { padding: 20px; font-size: 30px; width: 50px; text-align: center; text-decoration: none; } /* Add a hover effect if you want */ .fa:hover { opacity: 0.7; } /* Set a specific color for each brand */ /* Facebook */ .fa-facebook { background: #3B5998; color: white; } /* Twitter */ .fa-twitter { background: #55ACEE; color: white; }
기본 예시
예제 보기둥근 버튼
border-radius: 50%;로 둥근 단추를 만들고 width를 줄인다.
.fa { padding: 20px; font-size: 30px; width: 30px; text-align: center; text-decoration: none; border-radius: 50%; }
기본 예시
예제 보기참고
W3C School - How TO - Social Media Buttons