Stu の答えは、これまでの作業に最も近いものですが、テキストが内部で折り返される方法に基づいて、外側の div の高さが変化する可能性があるという事実はまだ考慮されていません。そのため、内側の div を (「パイプ」の高さを変更して) 1 回だけ再配置するだけでは十分ではありません。その変更はループ内で発生する必要があるため、適切な配置を達成したかどうかを継続的に確認し、必要に応じて再調整できます。
前の回答の CSS は引き続き完全に有効です。
#outer {
position: relative;
}
#inner {
float:right;
position:absolute;
bottom:0;
right:0;
clear:right
}
.pipe {
width:0px;
float:right
}
ただし、Javascript は次のようになります。
var innerBottom;
var totalHeight;
var hadToReduce = false;
var i = 0;
jQuery("#inner").css("position","static");
while(true) {
// Prevent endless loop
i++;
if (i > 5000) { break; }
totalHeight = jQuery('#outer').outerHeight();
innerBottom = jQuery("#inner").position().top + jQuery("#inner").outerHeight();
if (innerBottom < totalHeight) {
if (hadToReduce !== true) {
jQuery(".pipe").css('height', '' + (jQuery(".pipe").height() + 1) + 'px');
} else { break; }
} else if (innerBottom > totalHeight) {
jQuery(".pipe").css('height', '' + (jQuery(".pipe").height() - 1) + 'px');
hadToReduce = true;
} else { break; }
}