Limit text box to width of field - html

Help, I'm stuck with trying to limit text to the width of the actual field. Normally I would only need to set the max-length property but it doesn't work in for this scenario. I need something very similar to how Adobe handles multi-line textboxes...the line ends at the width of the text box and doesn't wrap. You must hit the return key to go to the next line.
I've searched around but really can't find anything specific.

Related

How to set text in a way that it starts a new line automatically after reaching limit

I'm trying to achieve this using flexbox where the icon and text are set with flex row property, but what i want to do is basically getting the full email without extending the border limit. I tried with flexbox wrap property but that doesn't apply here since its a single p tag.
Any solutions?
Perhaps
white-space:nowrap;
But if there is not enough space, the email address whill necessarily go out of the box :-(
A simulator to test the result of white-space.

Libgdx Find out where the lines ends

So I have a label - 200 width with wrap set to true. Before a set text to my label I want to check where first line ends, then when the second line end etc. Is it possible to check this? I'm working on text justify algorithm for label and I need to know where lines end.
GlypLayout may be useful.
glyplayout.width gives you exact length when you draw on screen so you can find out that how many chars can be drawn until you exceed 200 pixel width.

Float or wrap text around a chart?

I've been searching and searching for an answer to my question, but I can't seem to find anything. Does anyone know of a way to wrap/float text around a chart or image in SSRS? I was hoping for some kind of option similar to the blue one below in Word, but no luck there:
I found the following post, which has a good example image of what I'm looking for, but doesn't have any helpful answers (I'm not using Crystal Reports, I'm using BIDS SSRS through Visual Studio 2015).
Crystal report (or SSRS) flowing text around image
I've tried the following:
Overlaying a text box on top of the image (rendering shoves the image below the text)
Trying to find or create a mad scientist algorithm that can split the text after a certain number of characters, but not in the middle of a word, chop off the rest, and continue the rest of the text in a separate textbox under the image (not a mad scientist, so no luck)
Thanks for any tips!
There's no built in way to do this in SSRS.
Someone wrote a function that determines how many pixels are in a given text string.
Truncate textbox content with ellipsis in SSRS
Public Function TextWidth(str As String) AS Double
'Returns the width, in pixels, of a string, assuming Tahoma size 8.
Dim size As System.Drawing.SizeF
Dim font As New system.Drawing.Font("Tahoma", 8)
size = System.Windows.Forms.TextRenderer.MeasureText(str, font)
TextWidth = size.Width
End Function
You may be able to use this to figure out where to make a break in the first text box and spill the rest to the second. You'd just need to do testing to figure out how many pixels of text your first text box holds.
Once you figure out how many pixels would fit (I would just fill the first text box with text then use the function to see how many pixels that text is), change the other TextCap function to return either the first or second part at the pixel split. You could add an Argument in the function to indicate whether to return the first or second part of the text. Then use the function in the first text box to return the first part and the second part in the second text box.
It's a bit of work but seems feasible. It depends on how bad you want it and how much time you have.

Spark Label Truncating Issue

I have a Flex spark Label component with properties width=125 and maxDisplayedLines=1. This successfully truncates the text when it is too long to display, however if brackets are involved then the text is truncated in a way I do not want.
For example I set the text to "You (chinchiheather)" and it displays "You(..." never displaying any part of the text in brackets unless it can display all of it. I would prefer "You (chinchi..." than what I am being given. Is there some property I can set so that brackets are not treated specially, or does anyone know of some other way around this?
Thanks :)
The Label has a lineBreak style that you can use to control word wrapping. It also seems to apply to truncation. If you set the lineBreak style equal to "explicit", the text be truncated at the point it no longer fits, and not after an open parentheses.
The default value is for this style is "toFit".
<s:Label lineBreak="explicit" />
Or
var label:Label = new Label();
label.setStyle("lineBreak", "explicit");

Text overlap div

I have a comment box, if they enter long one word, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
the box will break(text out of div), i have used overflow:hidden but my friend want it to break like normal text.
Any idea how to fix ?
In order for overflow to hide content that is larger than it's containers' dimensions, the container must have a set width. But even so, CSS doesn't break long words. (Except for IE, which has the word-wrap: break-word instruction. Further reading.)
If you're using some sort of server side processing (I assume you are), you could manipulate text content by breaking up long words at a preset length and thus avoid overflowing.
You need to use whatever server language you have to devise some way to break the string up. You could use a combination of regex (to check for long unbroken strings) and then combine it with some string split function in order to insert some newlines or something.