简体   繁体   English

滚动时文本底部的不透明度

[英]Opacity in bottom of the text while scrolling

I want to put Opacity on the bottom of this text and it should stay so while scrolling, but when I scroll at the end it should be seen. 我想将“不透明度”放在此文本的底部,并且在滚动时应保持不变,但是当我滚动到最后时,应该可以看到它。 How can I do this ? 我怎样才能做到这一点 ?

Here is my code: 这是我的代码:

//html

large text goes here

//css #wrapper { height: 600px; width: 700px; overflow: auto; position: absolute; left: 25%; }

Add this to the #wrapper CSS: 将此添加到#wrapper CSS中:

-webkit-mask-image: -webkit-gradient(linear,left 20%,left bottom,from(black),to(rgba(0,0,0,0)))

Demo here 在这里演示

For a cross-browser ( Internet Explorer greater or equal than 10 ) solution you can do something like this: 对于跨浏览器( Internet Explorer大于或等于10 )解决方案,您可以执行以下操作:

HTML 的HTML

<div>
  content here
  <div class="overlay"></div>
</div>

CSS 的CSS

.overlay {
    position: fixed;
    left: 0;
    bottom: 0;
    height: 200px;
    width: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
}

jsfiddle jsfiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM