首页 > 解决方案 > 即使在放大后如何将子内容放入父 div 中

问题描述

如何在父 div 中放置子 div 内容。这样即使我放大屏幕,子 div 也不会从父 div 中出来。

<div>
            <div title="childDiv"  style="width:auto;">
                <h3 class="headerwidth" style="margin-top:1px; margin-bottom:0px"> &nbsp;Test:</h3>
                Welcome to the this new page test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
</div>

我试过溢出:隐藏但不起作用

标签: htmlcssbootstrap-4

解决方案


<style>
  p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
</style>
<div>
  <div title="childDiv">
    <h3 class="headerwidth"> &nbsp;Test:</h3>
    <p>Welcome to the this new page test test test test test test test   test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
    </p>
  </div>
</div>

希望我明白你的要求。

https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow


推荐阅读