midnite Posted November 10, 2006 Share Posted November 10, 2006 balabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabala ***************************************** in html, or css, or JavaScript, or any client side scripting, can i fix the table width to avoid what i have did above ? i mean, if someone typed such a long "word" and post it to our page, it will be a disaster to the look and the layout of our page. i know that there is a function called wordwrap() in PHP. But we don't know how many characters can my clients' browsers' table can hold. So if i can wrap the words in the client side, it must be great PS i have tried using "width" and "overflow" in CSS, but it won't work .. balabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabalabala ***************************************** in html, or css, or JavaScript, or any client side scripting, can i fix the table width to avoid what i have did above ? i mean, if someone typed such a long "word" and post it to our page, it will be a disaster to the look and the layout of our page. i know that there is a function called wordwrap() in PHP. But we don't know how many characters can my clients' browsers' table can hold. So if i can wrap the words in the client side, it must be great PS i have tried using "width" and "overflow" in CSS, but it won't work ..Oh !! This forum has cut the length by PHP ==is it possible for not cutting it in server side, i want the text wraps accordingly to the window or a specific width in the client side. It will be nice Link to comment Share on other sites More sharing options...
aspnetguy Posted November 10, 2006 Share Posted November 10, 2006 if you do <table style="width:500px">.... It will wrap the text for you. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 10, 2006 Share Posted November 10, 2006 You can detect what the size of the browser window is with Javascript. Here is some information about it:http://www.howtocreate.co.uk/tutorials/jav...t/browserwindowIf you want to do that, you will need to develop an algorithm to detect how much of the window your text box has, how big the font size is, if the text is bold, if there are images or other elements taking up space, and then how many letters you want to let through on one line. It's no easy task.Or, for any dynamic content, you can use PHP to split the text up by word, and for words longer then X number of characters, insert a space in them or something. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now