🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #142

Tooltip Arrows


Tooltip Arrows

To create an arrow that should appear from a specific side of the tooltip, add "empty" content after tooltip, with the pseudo-element class ::after together with the content property. The arrow itself is created using borders. This will make the tooltip look like a speech bubble.

This example demonstrates how to add an arrow to the bottom of the tooltip:

Bottom Arrow

  .tooltiptext::after {
  content: " ";
  position: absolute;

    top: 100%;
/* At the bottom of the tooltip */
  left: 50%;
  margin-left: -5px;

border-width: 5px;
  border-style: solid;

border-color: black transparent transparent transparent;
}

Example Explained

Position the arrow inside the tooltip: top: 100% will place the arrow at the bottom of the tooltip. left: 50% will center the arrow.

Note: The border-width property specifies the size of the arrow. If you change this, also change the margin-left value to the same. This will keep the arrow centered.

The border-color is used to transform the content into an arrow. We set the top border to black, and the rest to transparent. If all sides were black, you would end up with a black square box.


This example demonstrates how to add an arrow to the top of the tooltip. Notice that we set the bottom border color this time:

Top Arrow

  .tooltiptext::after {
  content: " ";
  position: absolute;
  bottom: 100%;  /* At the top of the tooltip */

    left: 50%;
  margin-left: -5px;

border-width: 5px;
  border-style: solid;

border-color: transparent transparent black transparent;
}

This example demonstrates how to add an arrow to the left of the tooltip:

Left Arrow

  .tooltiptext::after {
  content: " ";
  position: absolute;

    top: 50%;
  right: 100%; /* To the left of the
tooltip */
  margin-top: -5px;

border-width: 5px;
  border-style: solid;

border-color: transparent black transparent transparent;
}

This example demonstrates how to add an arrow to the right of the tooltip:

Right Arrow

  .tooltiptext::after {
  content: " ";
  position: absolute;

    top: 50%;
  left: 100%; /* To the right of the
tooltip */
  margin-top: -5px;

border-width: 5px;
  border-style: solid;

border-color: transparent transparent transparent black;
}

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Tooltip Arrows – FAQs

Quick answers about learning Tooltip Arrows in CSS.

This free note from CodingNow 2.0 explains Tooltip Arrows in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Tooltip Arrows, is 100% free with no signup required.
With focused practice, most students grasp Tooltip Arrows in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now