Wrap Text inside fixed Div with css or javascript? -
I have a tinymce editor (textarea) and a div. Whenever I type inside the text editor, Which is a real-time (200px) that looks like a stackflow preview
What do I want to achieve, if we type a word without a space and if it is more than 200 pixels , So I want to wrap it in the next line.
I tried to find it and I have not got the solution yet. I tried this solution which I found here
.preview_desc {word-wrap: break-word; / * IE & gt; = 5.5 * / white-space: pre; / * IE & gt; = 6 * / white-space: -moz-pre-wrap; / * Fx & lt; = 2 * / white-space: For pre-wrapping; / * Fx & gt; 3, opera & gt; 8, Safari & gt; 3 * /}
It does not work well in IE7. If it adds left and right space, then my division is so wide that like the following image
In IE8, this seems like the right one.
img35.imageshack.us/img35/3915/y8a.jpg (please add http: // and see)
Opera 10 is not working at all completely.
And then I also have a line count which I
var height = document.getElementById ('divivariuview'). ClientHeight; Var line = Math field (height / 10); Document.getElementById ('line'). InnerHTML = Rows; If (document.getElementById ('divpreview'). InnerHTML == "") {document.getElementById ('line'). InnerHTML = 0; }
If we use the above CSS code, it is starting to count with line 2 in all browsers except IE8 and 7.
I just want to work on all the latest browsers that are FF2,3, IE7, IE8, Safari, Chrome, Opera (latest).
Please help me please thank you.
I can misunderstand your problem, but it seems that you only have a bit of CSS Width, especially with a max-width (for all non-stupid browsers) and a wacky IE expression (for IE).
For example
max-width: 200px; _width: expression (document.body.clientWidth> 200? "200px": "auto");
When you already combine with CSS, it seems that it should work.
Comments
Post a Comment