如何显示 div 并使其在 css 转换延迟后隐藏

how to show a div and make it hide after a delay in css transition

我想显示一个暂停按钮并在单击幻灯片放映图像时消失。当他们再次点击它时,将显示一个播放按钮并在几秒钟内消失,就像在 youtube 中一样。我可以展示它,但不确定如何让它消失。就像我想让这个 div 弹出并在片刻后消失。

#play {
  border: 1px solid red;
  text-align: left;
  position: absolute;
  left: 50%;
  top: 50%;
}

您可以使用动画淡出效果来实现

animation: fadeOut 2s forwards;

https://www.tutorialspoint.com/css/css_animation_fade_out.htm 是了解它的好地方。