有没有办法使行类中的所有元素具有相同的高度? [英] Is there a way to make all elements in a row class the same height?

查看:21
本文介绍了有没有办法使行类中的所有元素具有相同的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Bootstrap 中,是否有一种简单的方法可以使一行中的所有 span 元素具有相同的高度,即最高元素的高度?

In Bootstrap, is there an easy way to make all the span elements in a row the same height, i.e. the height of the tallest element?

这是我的意思的一个例子.

Here's an example of what I mean.

http://jsfiddle.net/DVnZ6/

推荐答案

您可以使用 jQuery:

You can do it using jQuery:

boxes = $('.well');
maxHeight = Math.max.apply(
  Math, boxes.map(function() {
    return $(this).height();
}).get());
boxes.height(maxHeight);

这是一个例子:http://jsfiddle.net/DVnZ6/3/

这篇关于有没有办法使行类中的所有元素具有相同的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆