<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Display Title on Image</title> <style> .image-container { position: relative; display: inline-block; } .image-container::after { content: attr(data-title); position: absolute; bottom: 0; left: 0; width: 130px; background: rgb(164 159 159 / 70%); padding: 5px; text-align: center; color:#fff;font-weight:bold; font-family: sans-serif; } </style> </head> <body> <div data-title="快穿:总裁今天爱上我了"> <img src="/img/1006.jpg?1077" width="140px" height="180px"> </div> </body> </html>