<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div class="wrapper"> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> <div class="item"> 测试 </div> </div> </body> <style> .wrapper { width: 100vw; display: grid; grid-template-columns: repeat(4, 1fr); justify-content: space-between; } .wrapper .item { line-height: 170%; background-color: beige; border-radius: 20px; margin: 20px; padding: 20px; text-align: center; } .wrapper .item:hover { line-height: 170%; background-color: rgb(160, 188, 207); border-radius: 20px; margin: 20px; padding: 20px; } </style> </html>
标签:color,布局,wrapper,height,html,grid,测试,20px From: https://www.cnblogs.com/uoky/p/18417406