1、响应式页面(@media媒体查询)
2、源代码
2.1、效果:
2.2、源代码:
<!DOCTYPE html> <html lang="en"> <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>Document</title> <style> .container { display: flex; margin: 0 auto; flex: 1; text-align: center; } .item { width: 100%; background-color: antiquewhite; border: 1px solid black; } @media screen and (max-width:600px) { .container { flex-direction: column; } .item { width: 100%; } } </style> </head> <body> <div class="container"> <div class="item"> <p>用户名</p> </div> <div class="item"> <p>密码</p> </div> <div class="item"> <p>状态</p> </div> </div> </body> </html>