div内容,超出隐藏 滚动

2020-08-22  本文已影响0人  偶头像超凶
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>超出部分隐藏滚动条</title>
</head>
<style type="text/css">
    #box {
        width: 500px;
        height: 300px;
        overflow-x: hidden; //横行超过隐藏
        overflow-y: scroll;  //纵行超过隐藏
        line-height: 30px;  //line-height和height相同也是居中
        text-align: center;  //文字横向居中
    }
    #box::-webkit-scrollbar {
        display: none;  //可以滚动
    }
</style>
<body>
    <div id="box">
        欢迎光临 </br>
        欢迎光临 </br>
        欢迎光临 </br>
        欢迎光临 </br>
        欢迎光临 </br>
        欢迎光临 </br>
        欢迎光临 </br>
    </div>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读