I am trying to make a tooltip using html and css. The tooltip would be a rectangle that has a triangle on either the left or right hand sides. A visual example of this is seen below (I'm not concerned about the color or shadow, just that the triangle appears.
While I have been successful making a triangle using:
#triangle-left {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-right: 100px solid red;
border-bottom: 50px solid transparent;
}
When I attempt to append this using a pseudo-element to a div nothing happens. For example, I have tried:
.triangleTest {
height: 100px;
width: 100px;
}
.triangleTest:after {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-right: 100px solid red;
border-bottom: 50px solid transparent;
}
<div class="triangleTest"></div>
But nothing expect the square div appears on the screen. How can I create add a triangle to a div like in the image?