在固定 height/width 的 div 中显示溢出字符串的底部?

Show bottom of an overflow string in a div with fixed height/width?

背景

我有一个固定宽度和高度的不可滚动 div。 这是一个 JSFiddle:https://jsfiddle.net/Naibaf/47fm4pvf/2/

目标

如果不是前面的字符串,我想显示尽可能多的底部字符串。

推理与问题

你应该问问自己:为什么?我正在尝试显示 news-alert-like-bar,但我将 div 的内容与 setInterval() 连接起来,这会使它很快溢出。

根据我的判断,jQuery 的 .scrollTop() 如下所示:http://jsfiddle.net/2WpQf/1/ 不适合,因为我希望我的 div 不可滚动。同样适用于 CSS overflow.

有人知道怎么做吗?

HTML

<p>How to make the bottom of a string visible within the boundaries of a div and NOT show or hide the top part?</p>
<p>The opposite of what I want:
</p>
<div class="hidden">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div>

CSS

div.hidden {
background-color: #00FF00;
width: 100px;
height: 100px;
overflow: hidden;
}

你可以做的是使用一个额外的容器并从底部 position:absolute ,这样当你添加更多文本时,块似乎从底部到顶部增加:

div.hidden {
  position:relative;
    background-color: #00FF00;
    width: 100px;
    height: 100px;
    overflow: hidden;
}
/*Position extrawrap*/
div.hidden span {
  position:absolute;
  width:100%;
  bottom:0;
  left:0;
}
<div class="hidden">
  <! -- Extra Wrapper Here -->
  <span>
    You can use the overflow property when you want to have better control of the layout. The default value is visible.
  </span>
</div>


Demo Fiddle