Why “word-wrap” css style doesn't work inside a <table> (GWT)?

285 views
Skip to first unread message

Tom

unread,
Mar 30, 2014, 12:39:38 AM3/30/14
to google-we...@googlegroups.com

We got this css to make a long string (without any space in it, URL for example) to fall into many new lines rather than just show 1 line:

.wordWrap{  word-wrap:break-word;  }

in .xml file

<table>
    <tr>
       <td>
          <g:HTMLPanel ui:field="myPanel" addStyleNames="{style.wordWrap}" > <g:Label text="Aaaaaa..very long string without any space in it... aa"> <g:/HTMLPanel>
       </td>
    </tr>
</table>

This does not work.

However, if we remove the <table> then it work fine

So Why "word-wrap" css style doesn't work inside a (GWT)?

(http://stackoverflow.com/questions/22740185/why-word-wrap-css-style-doesnt-work-inside-a-table-gwt)

Jens

unread,
Mar 30, 2014, 10:34:59 AM3/30/14
to google-we...@googlegroups.com
You have to use table-layout:fixed in your CSS for the table element.

-- J.

Tom

unread,
Mar 31, 2014, 5:50:39 AM3/31/14
to google-we...@googlegroups.com
i did but it look really ugly. Ex: I got a DockLayoutPanel & in the <g:center> I have a HTMLPanel that hold <table>. So if i use <table style="table-layout:fixed"> then some how the text inside the table were centralised like this

|                  Aaaaaaaaaaaaaaaaaaaaaaaaaa                               |---> this is the edge of the <g:center>
                   aaaaaaaaaaaaaaaaaaaaaaaaaa                                |
                   aaaaaaaaaaaaaaaaaaaaaaaaaa

Am i doing right?

I want the text to go through all the spaces, ex it should look like this:
Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

even i use<table width="100%"> but it didn't work.

Do you know how to fix it?

Jens

unread,
Mar 31, 2014, 6:58:13 AM3/31/14
to google-we...@googlegroups.com
Do you know how to fix it?

The most basic example works: http://jsfiddle.net/84dsH/

So investigate your CSS using your browsers Dev Tools.

-- J.


Tom

unread,
Apr 1, 2014, 2:38:49 AM4/1/14
to google-we...@googlegroups.com
I couldn't fix the <table> tag so I start to use Grid. But Grid din't recognize the break-word
 

<g:Grid addStyleNames="{style.myBreakWord}">  
   
<g:row>
       
<g:cell>
           Subject
       
</g:cell>
       
<g:customCell>
           
<g:Label text="Aaaaaaaa....very long a...aaaaaaaaaaa" />
       
</g:customCell>
     
</g:row>
 
</g:Grid>

in Css
.myBreakWord{
    word-wrap:break-word; 
    table-layout:fixed;
}

Is there anything wrong with my code?
Reply all
Reply to author
Forward
0 new messages