overflow-x属性
overflow-x属性指定如果它溢出了元素的内容区是否剪辑左/右边缘内容。使用overflow-y属性可以来判断顶部和底部边缘是否裁剪。
语法:
overflow-x: visible|hidden|scroll|auto|no-display|no-content;
属性值:
visible
:不裁剪内容,可能会显示在内容框之外。hidden
:裁剪内容 - 不提供滚动机制。scroll
:裁剪内容 - 提供滚动机制。auto
:如果溢出框,则应该提供滚动机制。no-display
:如果内容不适合内容框,则删除整个框。no-content
:如果内容不适合内容框,则隐藏整个内容。
示例:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> div { width:110px; height:110px; border:thin solid black; overflow-x:hidden; } </style> </head> <body> <div><p style="width:140px"> In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. 'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.' </p></div> <p>Overflow-x指定是否要剪辑的左/右边缘的内容.</p> </body> </html>
效果图:
更多CSS相关知识,可访问 CSS教程 !!
以上就是css如何不显示横向滚动条?的详细内容,更多请关注0133技术站其它相关文章!