在这个jsfiddle中,我有一个包含一些文本和另一个div的div。容器是可滚动的。
内部div被截断,我需要在任何时候完全显示它(即不应该被截断或隐藏)。我不能在内部div中使用position:absolute。这可以实现吗?
<div style="background-color:orange;height:100px;overflow-y:scroll">
<p>
some text in the div
</p>
<p>
more text in the div
</p>
<div style="z-index:29999;background-color:yellow;width:80px">
I need to show this text, shouldn't be truncated
</div>
</div>
答案 0 :(得分:1)
<div style="background-color:orange;height:100px;overflow:auto">
<p>
some text in the div
</p>
<p>
more text in the div
</p>
<div style="z-index:29999;background-color:yellow;"> -->remove width from here`enter code here`
I need to show this text, shouldn't be truncated
</div>
</div>
答案 1 :(得分:0)
从子width:80px
中移除<div>
并放入max-width:100%;
答案 2 :(得分:0)
<div style="background-color:orange;height:100px;overflow-y:scroll">
<p>
some text in the div
</p>
<p>
more text in the div
</p>
<div style="z-index:29999;background-color:yellow;max-width:100%;">
I need to show this text, shouldn't be truncated
</div>
</div>
&#13;