Jump to content

Recommended Posts

this is my problem:

 

i have a table row which should be maximum 100px wide.

 

this row is populated by text extracted from a database.

 

sometimes words from this text are too long and exceeds the 100px width which screws up my design.

 

any idea how i can brake up that word after 100px to a next line?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/145469-solved-brake-up-word-issue/
Share on other sites

well, it's kind of general

 

let's say we havethis:

 

<table>

<tr>

<td  width=10px>

111111111111111111111111111111111111111111111111111

</td>

</tr>

</table>

 

because the text 111111... is long charactered, it won't stop at 10px wide but it will wide as far as the text goes..

 

 

that screws up my design

 

i dont have any solution yet

hi

 

i am still new to this but i just tested your code and from what i have picked up is that if you have multiple words then when it reaches the end of the column it will break that new word to a new link but if the word is really long then it cant split the word up so it has no option to extend the table.

 

i have tried fixing it with other solutions and css but i have had no luck.

 

jamie

I'm not 100% sure on exactly how different browsers handle this, but in firefox at least table cells seem to expand if text can't be split, whereas div's stay the specified size. That said, it still won't split the word across lines, and instead will either show it outside the div, or hide the extra bit, or show a scroll bar on the div, depending on what your 'overflow' attribute is set to.

 

That's probably not much help i'm afraid - I think your best bet is going to be to manually split the words.

yeah, if it were so easy..

 

my content is extracted from mysql...so no way of manual cutting...

 

when the word is wider than 10px, it auto expands the table cell, screwing up my design...

 

there must be something somewhere around to fix this issue, i'm sure..

 

i'm still searching

 

oh, tell me more about the div solution..

Use php (or whatever you're using to get the data from the DB) to automatically insert a break if a word is over a certain number of characters long?

 

Using divs - it'll mean you have to redesign your site using <div> tags instead of tables. It's hard to say much more without knowing what you're trying to do!

 

re haku: have you checked that? all the examples I've tried seem to expand the table cell to fit the content, no matter how you define the width.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.