Pelajari cara membuat chip kontak.
Chips kontak


Buat Kontak Chips
Langkah 1) Tambah HTML:
Contoh
<div class="chip">
<img src="img_avatar.jpg" alt="Person"
width="96" height="96">
John Doe
</div>
Langkah 2) Tambah CSS:
Contoh
.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%;
}
Cobalah sendiri " Closable Chips Kontak
Untuk menutup / menyembunyikan chip kontak, menambahkan elemen dengan onclick event atribut yang mengatakan "when you click you on me, hide my parent element" - yang merupakan wadah div (class="chip") .
Contoh
<div class="chip">
<img src="img_avatar.jpg" alt="Person"
width="96" height="96">
John Doe
<span class="closebtn"
onclick="this.parentElement.style.display='none'">×</span>
</div>
Tip: Gunakan entitas HTML " ×
" untuk membuat surat "x" .
Berikutnya, gaya tombol tutup:
Contoh
.closebtn {
padding-left: 10px;
color: #888;
font-weight: bold;
float: right;
font-size: 20px;
cursor: pointer;
}
.closebtn:hover
{
color: #000;
}
Cobalah sendiri "