nikhil
nikhil

Reputation: 9363

HTML dynamic element generation

I have a div tag which has some background color, that adds good look to my page. The div tag contains a button which when clicked generates two textboxes. Everything is working properly but the background is not expanding as and when new elements are added dynamically. I used height:auto in the div tag styling. How do i achieve background expansion as and when content gets added to the page dynamically?

Upvotes: 1

Views: 243

Answers (1)

Martin Jespersen
Martin Jespersen

Reputation: 26183

Assuming that you are not using absolute positioning on your child elements, all you have to do is set overflow:hidden on the parent, this will ensure that the parent expands around all the children inside.

Upvotes: 1

Related Questions