html paragraph does not "break" and the content is hidden

Asked

Viewed 230 times

0

I insert several comments that are received from the bank with the code below:

    $retorno = '<ul>';

    while($row = mysqli_fetch_assoc($select)){

        $retorno .= '
            <li id="comentario-resposta-'.$_POST['id'].'" class="comentario-resposta">
                <button class="btn btn-link">'.$row['nome_login'].'</button>
                <p>'.$row['comentario'].'</p>
            </li>
        ';
    }

    $retorno .= "</ul>";

css

.comentario-resposta p{
    display: block;
    position: relative;
    width: 50%;
}

This image shows the problem, I have a modal where are the comments, realize that there are two stay with hidden part and do not break the line.

inserir a descrição da imagem aqui

  • 2

    Try to use in this class: word-wrap: break-word?

  • No post imagens! See why in https://pt.meta.stackoverflow.com/questions/5483/manual-de-como-n%C3%83o-fazer-perguntas/5485#5485

  • @Leo Caracciolo he did not post a code image making the help impossible, but the problem, so I believe that there is no problem.

  • @Adrianoback, fine, but to do tests we would have to create the modal HTML, but fortunately there was a beast that solved without the need to test!

1 answer

1


What is common in the two comments, that there is only 1 word with many characters that exceed the limit of the div, so do not break the line... but if you still want to break the word in the limit of the div use in css:

.comentario-resposta p{
display: block;
position: relative;
width: 50%;
word-wrap: break-word;

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.