1 Replies - 1352 Views - Last Post: 17 July 2012 - 02:10 AM

#1 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

Trying to have text area dynamically scale to parent

Posted 12 June 2012 - 06:04 AM

I have the following code:
<div id="parent">
  <div id="images"><img src="..."/><img src="..."/><img src="..."/><img src="..."/><img src="..."/><img src="..."/><img src="..."/></div>
  <textarea style="width:100%; height:100%; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box;"></textarea>
</div>



when i scale #parent width or height, for some reason, my textarea was not readjusting to fit within the #parent div box. My thing is that #images will expand and shink to fit all of the contents, and then the remaining space will be populated by the textarea.

I tried to think that the 100% would work, but that will just make the text area the same size as the parent in both dimensions. Is there a way to be like width = #parent-#images or something?

Is This A Good Question/Topic? 0
  • +

Replies To: Trying to have text area dynamically scale to parent

#2 Astalor  Icon User is offline

  • New D.I.C Head

Reputation: 7
  • View blog
  • Posts: 22
  • Joined: 17-July 12

Re: Trying to have text area dynamically scale to parent

Posted 17 July 2012 - 02:10 AM

Hello there!

The only issue I can see with you not being able to make the textarea shrink within the parent div is that lack of any sizing on the #parent to actually require anything to resize in the first place.

<style>
	#parent
	{
		width: 500px;
		height: 500px;
	}
</style>


After applying the above code to yours, the textarea in question resized within the #parent with the images aligned top-right of the textarea.

Is there any CSS you forgot to include?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1