Doc Holiday
Doc Holiday

Reputation: 10254

trying to get text to WRAPin a table

enter image description here

Heres the code on the jsp:

<form id="commentForm" name="commentForm" action="" method="post">
<ctl:vertScroll height="300" headerStyleClass="data_table_scroll"   bodyStyleClass="data_table_scroll" enabled="${user.scrollTables}">
<ctl:sortableTblHdrSetup topTotal="false" href="show.whatif_edit_entry?entryId=${entry.entryId}"/>
<table class="data_table vert_scroll_table">
    <tr>
        <ctl:sortableTblHdr styleClass="center"  title="Comments" property="comment" type="top">Comments</ctl:sortableTblHdr>
    </tr>
    <c:forEach var="comments" items="${entry.comments}">
        <tr id="id${comments.id}">
            <td id="comments-${comments.id}" class="wrappable" style="width:400px;">${comments.comment}</td>
        </tr>
    </c:forEach>
    <c:if test="${lock.locked || form.entryId < 0 }">
        <%-- This is the row for adding a new comment. --%>
        <tr id="commentRow">


         <td>
         You have <strong><span id="commentsCounter">${const['COMMENT_MAX_LENGTH'] - fn:length(commentForm.comment)}</span></strong> characters left.<br/>
            <textarea id="comment" name="comment" rows="2" cols="125" style="width:395px;"
                 onkeypress="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"
                 onkeydown="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"
                 onkeyup="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)">
              </textarea>

                    <a href="javascript:addComment();"><img src="../images/icon_add.gif" border="0" alt="Add"/></a>
        </td>
    </tr>

we got some css for wrappable...am I calling it right??

td.wrappable,
table.data_table td.wrappable
{
white-space: normal;
}

thanks for the help..... : )

Upvotes: 0

Views: 102

Answers (1)

Jason Kaczmarsky
Jason Kaczmarsky

Reputation: 1686

In my experience, things will not wrap unless they have a space in them. In this example, the guy splits long words in PHP with spaces: Example

There is also a word-wrap setting in CSS which can break a long word apart: Sorry for W3Schools =(

Upvotes: 1

Related Questions