@@ -14,6 +14,8 @@
background-color: red;
/* vh viewport height 视口高度 */
/* vi viewport width 视口宽度 */
+ /* 1vh 等于 视口高度的 1% */
+ /* 1vw 等于 视口宽度的 1% */
height: 100vh;
width: 100vw;
}
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Document</title>
+ <style>
+ .box{
+ width: 100px;
+ height: 100px;
+ background-color: red;
+ /* opacity: 0; */
+ display: none;
+ }
+ button:hover + .box{
+ display: block;
+ </style>
+</head>
+<body>
+ <button>显示/隐藏</button>
+ <div class="box"></div>
+ hello
+</body>
+</html>