كيف - رقائق الاتصال
تعرف على كيفية إنشاء شرائح اتصال باستخدام CSS.
رقائق الاتصال
فلان الفلاني
جين رو
×
إنشاء شرائح الاتصال
الخطوة 1) أضف HTML:
مثال
<div class="chip">
<img src="img_avatar.jpg" alt="Person"
width="96" height="96">
John Doe
</div>
الخطوة 2) أضف 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">
John Doe
<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;
}