当父级div
height:auto的子级定位为绝对/固定时,则无法使用。
您将需要使用Javascript来实现此目的。
jQuery中的一个示例:
var biggestHeight = 0;// Loop through elements children to find & set the biggest height$(".container *").each(function(){ // If this elements height is bigger than the biggestHeight if ($(this).height() > biggestHeight ) { // Set the biggestHeight to this Height biggestHeight = $(this).height(); }});// Set the container height$(".container").height(biggestHeight);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)