<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>提示文字上下左右居中</title> <style type="text/css"> .hintBox{ position: fixed; top: 50%; left: 50%; z-index: 999999; -webkit-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); transform: translate(-50%, -50%); background: #000; color: #fff; padding: 8px 12px; border-radius: 100px; display: none; } </style> </head> <body> <div class="hintBox">提示文字上下左右居中</div> </body> </html> 几秒后隐藏 $(".hintBox").show().delay(1500).fadeOut();