كيفية إنشاء: الإشارة

تعلم كيفية استخدام CSS لإنشاء الإشارات.

ضع الفأرة فوق النص التالي:

العمود نص الإشارة
اليمين نص الإشارة
الأسفل نص الإشارة
اليسار نص الإشارة

جربها بنفسك

كيفية إنشاء الإشارة

الخطوة الأولى - إضافة HTML:

<div class="tooltip">مرر الفأرة فوقي
  <span class="tooltiptext">نص الإشارة</span>
</div>

الخطوة الثانية - إضافة CSS:

/* وعاء الإشارة */
.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black; /* إذا كنت ترغب في إضافة خط نقطي تحت النص المعلق */
}
/* نص الإشارة */
.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: #555;
  color: #fff;
  text-align: center;
  padding: 5px 0;
  border-radius: 6px;
  /* يحدد موقع نص الإشارة */
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  /* يظهر نص الإشارة بشكل تدريجي */
  opacity: 0;
  transition: opacity 0.3s;
}
/* إشارة الإشارة */
.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}
/* يظهر نص الإشارة عند وضع الفأرة فوق وعاء الإشارة */
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

جربها بنفسك

الصفحة ذات الصلة

التعليمات: }}ميزة النصوص التوضيحية CSS

التعليمات: }}كيفية إنشاء نافذة إصدار

التعليمات: }}كيفية إنشاء نموذج