CSS 动态提示框

​​

<template>
<div class="terminal-loader">
  <div class="terminal-header">
    <div class="terminal-title">提示框</div>
    <div class="terminal-controls">
      <div class="control close"></div>
      <div class="control minimize"></div>
      <div class="control maximize"></div>
    </div>
  </div>
  <div class="text">温馨提示!</div>
</div>

</template>

<script>

</script>

<style>
@keyframes blinkCursor {
  50% {
    border-right-color: transparent;
  }
}

@keyframes typeAndDelete {
  0%,
  10% {
    width: 0;
  }
  45%,
  55% {
    width: 200rpx;
  } /* adjust width based on content */
  90%,
  100% {
    width: 0;
  }
}

.terminal-loader {
  border: 0.1em solid #333;
  background-color: #1a1a1a;
  color: #0f0;
  font-family: "Courier New", Courier, monospace;
  font-size: 1em;
  padding: 1.5em 1em;
  width: 200rpx;
  margin: 100px auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  height: auto;
}

.terminal-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5em;
  background-color: #333;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  padding: 0 0.4em;
  box-sizing: border-box;
}

.terminal-controls {
  float: right;
}

.control {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-left: 0.4em;
  border-radius: 50%;
  background-color: #777;
}

.control.close {
  background-color: #e33;
}

.control.minimize {
  background-color: #ee0;
}

.control.maximize {
  background-color: #0b0;
}

.terminal-title {
  float: left;
  line-height: 2em;
  color: #eee;
  font-size: 15rpx;
}

.text {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  border-right: 0.2em solid green; /* Cursor */
  animation: typeAndDelete 4s steps(11) infinite,
    blinkCursor 0.5s step-end infinite alternate;
  margin-top: 1.5em;
  word-wrap: break-word;
}

</style>

教学视频地址

点击跳转教学视频

相关推荐
_.Switch几秒前
Python Web 开发中的性能优化策略(一)
开发语言·前端·python·性能优化·django·flask·fastapi
让开,我要吃人了3 小时前
HarmonyOS开发实战(5.0)实现二楼上划进入首页效果详解
前端·华为·程序员·移动开发·harmonyos·鸿蒙·鸿蒙系统
everyStudy4 小时前
前端五种排序
前端·算法·排序算法
甜兒.5 小时前
鸿蒙小技巧
前端·华为·typescript·harmonyos
Jiaberrr8 小时前
前端实战:使用JS和Canvas实现运算图形验证码(uniapp、微信小程序同样可用)
前端·javascript·vue.js·微信小程序·uni-app
everyStudy9 小时前
JS中判断字符串中是否包含指定字符
开发语言·前端·javascript
城南云小白9 小时前
web基础+http协议+httpd详细配置
前端·网络协议·http
前端小趴菜、9 小时前
Web Worker 简单使用
前端
web_learning_3219 小时前
信息收集常用指令
前端·搜索引擎
tabzzz9 小时前
Webpack 概念速通:从入门到掌握构建工具的精髓
前端·webpack