<!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> .box { width: 300px; height: 300px; background-color: pink; /* 溢出隐藏 */ overflow: hidden; /* 滚动: 无论内容是否超出都显示滚动条的位置 */ /* overflow: scroll; */ /* auto: 根据内容是否超出, 判断是否显示滚动条 */ /* overflow: auto; */ } </style> </head> <body> <div class="box">我是div,测试溢出显示效果我是div</div> </body> </html>