+ -
当前位置:首页 → 问答吧 → 简单的问题,如何不出现横向的滚动条

简单的问题,如何不出现横向的滚动条

时间:2011-10-12

来源:互联网


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> new document </title> <style type="text/css"> div {width:100px; height:200px; background:#333; position:absolute; top:50px; right:-50px;} </style> </head> <body> <div>test</div> </body> </html>
 提示:您可以先修改部分代码再运行

作者: caicaihui   发布时间: 2011-10-12

加一句
body{overflow:hidden;}

作者: auror   发布时间: 2011-10-12

内容多了如何处理,上下滚动条给搞没有了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> new document </title> <style type="text/css"> body {overflow:hidden} .test {width:100px; height:200px; background:#333; position:absolute; top:50px; right:-50px;} </style> </head> <body> <div class="test">test</div> <div style="height:2000px;"></div> </body> </html>
 提示:您可以先修改部分代码再运行

作者: caicaihui   发布时间: 2011-10-12

永远不会出现
overflow-x:hidden
overflow-y:hidden
内容超出出现
overflow-x:auto
overflow-y:auto

作者: leilay   发布时间: 2011-10-12


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> new document </title> <style type="text/css"> body {overflow-x:hidden;overflow-y:auto} .test {width:100px; height:200px; background:#333; position:absolute; top:50px; right:-50px;} </style> </head> <body> <div class="test">test</div> <div style="height:2000px;"></div> </body> </html>
 提示:您可以先修改部分代码再运行
如何能兼容到IE6和IE7

作者: caicaihui   发布时间: 2011-10-12

热门下载

更多