어떻게 만들지: 연락처 챌린지
CSS를 사용하여 연락처 챌린지를 만들어보는 방법을 배웁니다.
연락처 챌린지


연락처 챌린지 생성
第一步 - HTML 추가:
<div class="chip"> <img src="img_avatar.jpg" alt="Person" width="96" height="96"> 빌 게이츠 </div>
第二步 - CSS 추가:
.chip { display: inline-block; padding: 0 25px; height: 50px; font-size: 16px; line-height: 50px; border-radius: 25px; background-color: #f1f1f1; } .chip img { float: left; margin: 0 10px 0 -25px; height: 50px; width: 50px; border-radius: 50%; }
닫히는 연락처 챌린지
연락처 챌린지를 닫기/숨기려면, onclick
이벤트 속성 요소가 있으며, 이 속성은 "나를 클릭하면 부모 요소를 숨기겠다" - 즉 컨테이너를 의미합니다 <div class="chip">
。
실례
<div class="chip"> <img src="img_avatar.jpg" alt="Person" width="96" height="96"> 빌 게이츠 <span class="closebtn" onclick="this.parentElement.style.display='none'">×</span> </div>
안내:HTML 엔티티 "×
"알파벳 "x"를 만듭니다。
다음은 닫기 버튼의 스타일을 설정합니다:
실례
.closebtn { padding-left: 10px; color: #888; font-weight: bold; float: right; font-size: 20px; cursor: pointer; } .closebtn:hover { color: #000; }