Hi! I have a div that expands as the user types into a textarea that copies its text into the div. I want that div to stop expanding its width when it hits the outer edge of the other div that is its grandparent, but I have found no solutions online for how to do that. Currently when the div hits the outer edge it just moves itself to the next line below until it is the only element on the line (which I do not want). I’d like it to expand its height downwards.
See this jsfiddle for exactly what I mean and type into the first textarea:
I also don’t want to hardcode any pixel values (like max-width: 16px; or whatever). I’d like to make this dynamic enough that it works no matter how much space the div has available to expand to.
Hi Ray! That is (almost) exactly right! The only thing is I don’t want the div (outlined in orange) to move down to the next line when the text becomes too big. So in the example screenshot you gave, instead of having the div that wraps around the input and the orange-outlined div move down to the next line underneath “Some text:”, I would like it to stay on the same line as “Some text:” and then expand vertically.