123456789101112131415161718192021222324252627282930 |
- <!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>
- *{
- margin: 0;
- }
- .box1{
- float: left;
- width: 300px;
- height: 100px;
- background-color:red;
- }
- .box2{
- float: left;
- height: 100px;
- /* calc 可以实现+、-、*、/ 数学运算,运算符两侧必须加空格 */
- width: calc(100% - 300px);
- background-color: blue;
- }
- </style>
- </head>
- <body>
- <div class="box1"></div>
- <div class="box2"></div>
- </body>
- </html>
|