html - How to put the height of a div that contains other with absolute position? -
how put height of div contains other absolute position?
<html> <head> <style type="text/css"> .a{ } .b{ position:relative; } .c{ position:absolute; } </style> </head> <body> <div class="a"> <div class="b"> <div class="c"> esto es lo que contiene el div<br/> esto es lo que contiene el div<br/> esto es lo que contiene el div<br/> esto es lo que contiene el div<br/> </div> </div> </div> </body> </html>
the height of div class "a" zero
an absolutely positioned element not take space in layout, meaning <div class='a'>
won't expand wrap it.
the way possibly measure height of .c
via javascript , set height of .a
explicitly -- downside, of course, requiring javascript so.
depending on trying position .c
may want consider using float instead, can wrapped.
Comments
Post a Comment