7 Replies - 1102 Views - Last Post: 28 March 2013 - 12:34 AM

How to set border to div element for text formatting?

Posted 24 March 2013 - 10:57 AM

Hi, I'm working a comment section page where it allows the user to leave a comment. I need assistance in my layout for displaying the comments into the repeater control. I used to put the comments inside the div element of the item and alternatingitem template of the repeater. And as a result, the comment would go straight along the line in the div element if the user is typing too many words or paragraph. What I want is to put a limit where the text will stop and proceed to the next line of the div element. How would I do that?What is the best way?Any suggestion? Here's my layout for the repeater control where I used to insert the comments.

Re: How to set border to div element for text formatting?

Posted 24 March 2013 - 11:59 AM

I tried to set its height but only the height will change. I'm trying to put a limit to comments being entered where
it will automatically jump to a new line when reaching its boundery being set to. So, if Divs has no next line what
is the best way to use?

Re: How to set border to div element for text formatting?

Posted 24 March 2013 - 12:53 PM

mitkram, on 24 March 2013 - 06:59 PM, said:

I tried to set its height but only the height will change. I'm trying to put a limit to comments being entered where
it will automatically jump to a new line when reaching its boundery being set to. So, if Divs has no next line what
is the best way to use?

I suggested changing the width, not the height. I only suggested also changing the height if the DIV is editable.

You haven't clarified (particularly as I, personally, don't use ASP); are the DIVs editable so that they are for the user to create a comment? Or are they used to display comments retrieved from a database?

Re: How to set border to div element for text formatting?

Posted 24 March 2013 - 01:24 PM

Well, setting a width would normally cause a div to expand vertically to fit its content. You might try overflow: visible; or overflow: auto; as maybe the div behaves differently if it already exists or is created dynamically.

Re: How to set border to div element for text formatting?

Posted 28 March 2013 - 12:34 AM

simply (but grammatically incorrect) breaking words at the end of the line can be done with CSS3’s word-wrap property.

for a grammatically correct word breaking you need to insert soft hypens (&shy;) into your words (then it automatically breaks the words). this can also be automated by Java​Script (e.g. the Hyphenator library).