html - Make parent div with absolute position take the width of children divs -
html - Make parent div with absolute position take the width of children divs -
i have next html structure:
<div class="parent"> <div class="child1"></div> <div class="child2"></div> </div>
the parent positioned absolutely, child1 , child2 displayed side-by-side using inline-block. need whole thing responsive based on width of 2 children divs. problem is, if increment width of of them, parent's width remains same. changing position relative fixes this, have have in absolute. there anyway responsive?
edit:
i hoping simple, apparently not much... :( here's actual html:
<div class="action_container"> <div class="action_inner"> <div class="action_title">format text</div> <div class="action_body"> <div class="action_args_section"></div> <div class="action_output_section"></div> </div> </div> </div>
and css:
<style> .action_container { display: block; position: absolute; } .action_inner { border: 1px solid black; } .action_inner { min-width: 120px; min-height: 50px; background-color: white; border: 1px solid #666; border-radius: 5px; } .action_title { font-size: 12px; font-weight: bold; text-align: center; border-bottom: 1px solid #ccc; padding: 3px; } .action_args_section { display: inline-block; box-sizing: border-box; -moz-box-sizing: border-box; padding: 3px; } .action_output_section { display: inline-block; width: 50px; vertical-align: top; box-sizing: border-box; -moz-box-sizing: border-box; padding: 3px; } </style>
demo
<div class="parent"> <div class="child1"></div> <div class="child2"></div> </div> .parent { position:absolute; height:50px; border:1px solid red; } .child1 { width:100px; height:30px; border:1px solid green; } .child2 { width:150px; height:30px; border:1px solid blue; }
is you're looking for?
html css responsive-design
Comments
Post a Comment