【问题标题】:How to create text auto-paragraphs in div?如何在 div 中创建文本自动段落?
【发布时间】:2020-09-27 02:19:16
【问题描述】:

如何在最大宽度为 200 像素等的 div 中创建新段落。 当我的文本长度超过 200px 时,我希望在 div 中创建一个新段落。

有可能吗?

body {
    background-color: #6B6B6B;
    margin: 50px;   
    font-family: Arial;
    color: grey;
    font-size: 12px;
    font-weight: 100;
    line-height: 1;
    letter-spacing: .5px;
}
    .bubble {
    position: absolute;
    height: 40px;
    padding-left: 15px;
    padding-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0px 30px 30px 30px;
    background-color:rgba(0, 0, 0, .3);
}
<p style="color:white;">i.e. when max div width (200px) is reached new paragraph is made:</p>

<p class="bubble">Hi Yummi</p>

<p>&nbsp;</p>
<p>&nbsp;</p>

<p class="bubble">Hi Yummi, how are you <br>do you find your cat?</p>

【问题讨论】:

    标签: html css paragraph


    【解决方案1】:

    解决办法:

    max-width:200px;
    padding: 15px;
    

    PS 不要使用高度:

    【讨论】:

    • 这不会创建新段落。它只是将元素的宽度限制为 200px,将输入的文本换行到下一行。
    猜你喜欢
    • 2012-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-08
    • 2016-11-04
    • 2016-12-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多