栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

检查元素的内容是否溢出?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

检查元素的内容是否溢出?

如果只想显示更多内容的标识符,则可以使用纯CSS来实现。我为此使用纯滚动阴影。诀窍是使用

background-attachment:local;
。您的CSS看起来像这样:

.scrollbox {  overflow: auto;  width: 200px;  max-height: 200px;  margin: 50px auto;  background:        linear-gradient(white 30%, rgba(255,255,255,0)),    linear-gradient(rgba(255,255,255,0), white 70%) 0 100%,        radial-gradient(50% 0, farthest-side, rgba(0,0,0,.2), rgba(0,0,0,0)),    radial-gradient(50% 100%,farthest-side, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;  background:        linear-gradient(white 30%, rgba(255,255,255,0)),    linear-gradient(rgba(255,255,255,0), white 70%) 0 100%,        radial-gradient(farthest-side at 50% 0, rgba(0,0,0,.2), rgba(0,0,0,0)),    radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;  background-repeat: no-repeat;  background-color: white;  background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;    background-attachment: local, local, scroll, scroll;}<div >  <ul>    <li>Not enough content to scroll</li>    <li>2</li>    <li>3</li>    <li>4</li>    <li>5</li>  </ul></div><div >  <ul>    <li>Ah! Scroll below!</li>    <li>2</li>    <li>3</li>    <li>4</li>    <li>5</li>    <li>6</li>    <li>7</li>    <li>8</li>    <li>9</li>    <li>10</li>    <li>1</li>    <li>2</li>    <li>3</li>    <li>4</li>    <li>5</li>    <li>6</li>    <li>7</li>    <li>8</li>    <li>The end!</li>    <li>No shadow there.</li>  </ul></div>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/464756.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号