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 hei开发者_运维技巧ght:auto in the div tag styling. How do i achieve background expansion as and when content gets added to the page dynamically?
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.
精彩评论