content:attr()
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <style> .tooltip-block { position: absolute; top: 100px; left: 100px; } .tooltip-block:hover:after { border: 1px solid #fc0; padding: 3px 6px; background: #fffea1; content: attr(data-title); position: absolute; left: 0; top: -26px; } </style> <span class="tooltip-block" data-title="123456789">123</span> </body> </html>