Collapse a DIV hiding its content even if defined in percentage
问题 I'm trying to obtain a DIV that could collapse on click. For this simple example, click is triggered directly on the entire DIV. <div id='fixed'> <input type='text'> </div> #fixed { width: 200px; } #fixed input { width: 180px; } .short_fixed { width: 50px !important; } $('#fixed').click(function(){ $(this).toggleClass('short_fixed'); }); My example shows 2 cases: first one use "fixed" width object, while the second one use "percentage" width. When clicked, first DIV truncates without resizing