<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>引用了css 和 js文件的示例</title> <link rel="stylesheet" href="./index.css"> <style> /*#region*/ .container { width: 800px; min-height: 400px; margin: 20px auto; background-color: rgb(132, 121, 110); display: flex; } .item { text-align: center; font-size: 30px; } /* 子项的宽高 是精心设计过的,大小不一、有无设置不同,只有这样才能测试出各种情况。统一宽高的情况下,变得简单了却难以测试。 */ /* 子项的文本内容 也是精心设计过的,x便于观察基线(baseline)、g下部凸出、j是全高字符等,便于测试,否则aling-itme:baseline等测试不出来效果。 */ .item1 { height: 150px; background-color: blueviolet; } .item2 { /* width: 200px; height: 200px; */ background-color: green; } .item3 { font-size: 100px; width: 250px; height: 150px; background-color: skyblue; } .item4 { width: 200px; height: 200px; background-color: coral; } .item5 { width: 200px; height: 100px; background-color: deeppink; } .item6 { background-color: forestgreen; } .item7 { width: 200px; height: 120px; background-color: saddlebrown; } .item2::after,.item6::after { content: "无高"; } .item1::after,.item4::after { content: "无宽"; } /* #endregion */ </style> </head> <body> <div class="container"> <div class="item item1">x</div> <div class="item item2">x</div> <div class="item item3"> xgj3 </div> </div> <div class="container"> <div class="item item1">x</div> <div class="item item2">x</div> <div class="item item3"> xgj3 </div> <div class="item item4">x</div> <div class="item item5"> xgj5 </div> <div class="item item6">x</div> <div class="item item7"> xgj7 </div> </div> <script src="./index.js"></script> <script> console.log('hello from JavaScript!'); </script> </body> </html>