<div id="parent"> <div id="child">Estoy flotando</div> Texto dummy aqui <span class="clearfix"></span> </div> <br /> <div id="parent2"> <div id="child2">Estoy flotando 2</div> Texto dummy aqui 2 </div> <br /> <div id="parent3"> <div id="child3">Estoy flotando 3</div> Texto dummy aqui 3 </div>
/************primer metodo***************/ #parent { width:200px; background-color:rgb(167, 205, 240); padding:5px; } #child { float:right; width:75px; background-color:rgb(125, 199, 131); color:white; height:100px; padding:5px; } .clearfix { display:block; clear:both; width:0px; height:0px; } /**********segundo metodo*******************/ #parent2 { width:200px; background-color:rgb(167, 205, 240); padding:5px; } #parent2:after { content:""; display:block; clear:both; visibility:hidden; } #child2 { float:right; width:75px; background-color:rgb(125, 199, 131); color:white; height:100px; padding:5px; } /***********tercer metodo************************/ #parent3 { overflow:hidden; width:200px; background-color:rgb(167, 205, 240); padding:5px; } #child3 { float:right; width:75px; background-color:rgb(125, 199, 131); color:white; height:100px; padding:5px; }