以下介绍overflow的常用方法:
1.overflow:hidden 溢出隐藏;
2.overflow:scroll 出现滚动条;
3.overflow:auto 自动调整格式;
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>overflow</title> <style> div { width: 200px; height: 200px; border: 1px solid red; /* overflow:hidden ; */ /* 溢出隐藏 */ /* overflow: scroll; */ /* 滚动文字 ,不管内容是否超出边框都会显示滚动条*/ overflow:auto; /* 需要的时候有滚动条,不需要的时候没有滚动条 */ } </style> </head> <body> <div> 我是文字我是文字我是文字 我是文字我是文字我是文字 我是文字我是文字我是文字 我是文字我是文字我是文字 我是文字我是文字我是文字 我是文字我是文字我是文字 我是文字我是文字我是文字</div> </body> </html>