A column in my table stores URLs. Sometime, the URL is too long - that column will be wide and so the table. The table crosses over the border to the right of the screen and it looks so ugly.
Therefore, I want to have a scroll bar and put my table in there so I can scroll it if the table is too large
I want to create a function that will add tag < br/> for long url. However web browsers display tag < br/> as I display these url as clickable links. E.g:
I would use the PHP function wordwrap that breaks the URL display string up into smaller pieces, with a space between them. You don't need the "br" tag because the browser will automatically wrap the long text at a space, in an effort to keep the table within its assigned boundaries.
Comments
Highly Unusual
It's not a normal technique to add a scroll bar to a table cell, and I don't believe that there is a direct way to do so.
The only work-around I can think of is to add a div within the table cell, then add "overflow: scroll" to that div.
May I ask what you trying to accomplish? There may be another way to meet your goal without using a scroll...
---------------------------------
Steven Wright
Slalom
Thanks
A column in my table stores URLs. Sometime, the URL is too long - that column will be wide and so the table. The table crosses over the border to the right of the screen and it looks so ugly.
Therefore, I want to have a scroll bar and put my table in there so I can scroll it if the table is too large
I want to create a function that will add tag < br/> for long url. However web browsers display tag < br/> as I display these url as clickable links. E.g:
The url displayed in Web browsers has the tag < br/> and was not broken down into two lines as I want
Thanks
Break the string manually
I would use the PHP function wordwrap that breaks the URL display string up into smaller pieces, with a space between them. You don't need the "br" tag because the browser will automatically wrap the long text at a space, in an effort to keep the table within its assigned boundaries.
Simplified example:
Reference:
http://www.php.net/manual/en/function.wordwrap.php
---------------------------------
Steven Wright
Slalom
thanks
I follow your suggestion, using function str_replace ("/", " /", $long_url).
So new line is created when there is "/" character
Thanks
Try using adding wbr-elements to indicate possible line wraps...
Try using a to indicate where the browser can wrap the line - see http://www.quirksmode.org/oddsandends/wbr.html for more info.
So...