|
|
@@ -0,0 +1,28 @@
|
|
|
+<!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: 500px;
|
|
|
+ height: 300px;
|
|
|
+ border: 3px solid black;
|
|
|
+ }
|
|
|
+ .box1{
|
|
|
+ height: 200px;
|
|
|
+ background-color: red;
|
|
|
+ /* calc 可以实现基础数学运算 */
|
|
|
+ /* 100% 是 box 的宽度,减去 200px 就是 box1 的宽度 */
|
|
|
+ /* calc 运算符号左右都需要空格 */
|
|
|
+ width: calc(100% - 200px);
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="box">
|
|
|
+ <div class="box1"></div>
|
|
|
+ </div>
|
|
|
+</body>
|
|
|
+</html>
|