vue项目中css隐藏滚动条并实现滚动功能
template中<template><div class="box" style="width: 200px;height: 200px;background-color: black;"><div class="inner"><p>1</p><p>2</p><p>3</p><p&g
·
template中
<template>
<div class="box" style="width: 200px;height: 200px;background-color: black;">
<div class="inner">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
</div>
</div>
</template>
style中使用less语法
<style lang="less">
.box {
width: 360px;
height: 200px;
position: relative;
overflow: hidden;
.inner{
position: absolute;
left: 0;
top: 0;
right: -17px;
bottom: 0;
overflow-x: hidden;
overflow-y: scroll;
text-align: left;
color: white;
}
}
</style>
此css使用了less语法,相关连接在下方,可以进行学习
更多推荐
已为社区贡献1条内容
所有评论(0)