I used a CSS triangle generator to create the arrow.
Edit: Added CSS for center alignment. Also provided comments in CSS explaining each value.
Add :hover
pseudo selector to show tooltips only on hover. I removed them for easier development.
.center-align {
text-align: center;
}
[title] {
position: relative;
}
[title]:before,
[title]:after {
z-index: 98;
}
[title]:before {
bottom: -10px;
/* calculate 50% width of the parent element minus width of the current element */
left: calc(50% - 10px);
width: 0;
height: 0;
border-style: solid;
border-width: 0 10px 10px 10px;
border-color: transparent transparent #333 transparent;
content: "";
position: absolute;
display: block;
}
[title]:after {
background: #333;
/* calculate single line height plus height of the arrow element */
top: calc(1em + 10px);
border-radius: 5px;
color: #fff;
content: attr(title);
padding: 5px 10px;
position: absolute;
/* calculate 50% width of the parent minus half of the width of current element minus half of the padding */
left: calc(50% - 45px - 5px);
/* requires fixed width for calculation above */
width: 90px;
text-align: center;
}
<span class="dijitButtonContents" id="saveButton" title="Save as draft">
<span id="saveButton_label">Save and write a long description</span>
</span>
<br/><br/><br/><br/>
<span class="dijitButtonContents" id="saveButton" title="Save as draft">
<span id="saveButton_label">Save</span>
</span>
<div class="center-align">
<span class="dijitButtonContents" id="saveButton" title="Save as draft">
<span id="saveButton_label">Save and write a long description</span>
</span>
<br/><br/><br/><br/>
<span class="dijitButtonContents" id="saveButton" title="Save as draft">
<span id="saveButton_label">Save</span>
</span>
</div>