Line break (Wrap) Text in DIV for defined width using CSS

Last Reply 7 days ago By anvina

Posted 7 days ago

Max-width 80% results in horizontal scrollbar if content too big for window.

I want the text to come to next line if it does not fit 80% of a small window. but i get scrollbar instead.

<!DOCTYPE html>
    height: 98.5%;
    margin: 0;
    <table id="tblChat" style="width: 100%; height: 100%; margin: 0;" cellspacing="0" cellpadding="0">
        <tr style="height: 85%; background-color: #fafaf7; border: solid 1px lightgray; border-bottom: none;">
            <td style="vertical-align: top; height: 100%;">                                    
            <div id="divCommLog">
                <div style="max-width:80%;border:1px solid red;">hfghfghfghfghfghfghfghfhfghfghfghfghfghfghfghfghgfghfhfghfghfghfghfghfghfghfghgfghfhfghfghfghfghfghfghfghfghgfghfhfghfghfghfghfghfghfghfghgfghfghgfghfgh</div>
You are viewing reply posted by: anvina 7 days ago.
Posted 7 days ago Modified on 7 days ago

I cant do that... what i have sent you is a sample .. the actual structure is very big with a lot of controls in the table....

If i use table-layout : fixed it solves my issue.....



I agree, here is the link: