相关疑难解决方法(0)

CSS - 相等高度列?

在CSS中,我可以这样做:

在此输入图像描述

但我不知道如何将其改为:

在此输入图像描述


这可能与CSS有关吗?

如果是,我怎么能在没有明确指定高度的情况下做到(让内容增长)?

html css

57
推荐指数
4
解决办法
4万
查看次数

使用jQuery使页面上的多个元素具有相同的高度

我有一个函数,我用来在页面上创建equalheight所有相同高度(最高元素的高度)的元素:

equalheight = function(container){

    var currentTallest = 0,
        currentRowStart = 0,
        rowDivs = new Array(),
        $el,
        topPosition = 0;

    $(container).each(function() {
        $el = $(this);
        $($el).height('auto')
        topPostion = $el.position().top;

        if (currentRowStart != topPostion) {
            for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
                rowDivs[currentDiv].height(currentTallest);
            }
            rowDivs.length = 0; // empty the array
            currentRowStart = topPostion;
            currentTallest = $el.height();
            rowDivs.push($el);
        } else {
            rowDivs.push($el);
            currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
        }
        for (currentDiv = 0 …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

8
推荐指数
1
解决办法
1354
查看次数

通过javascript中的动态内容查找div的最大高度

我有一个 div 并且不止一个数据通过 jstl 标签进入这个 div。我想找到最大内容 div 高度。我看到了一个链接,但它每次都显示在警报中 20. 具有一组元素中最大高度的元素

JSP

     <div id="div-height" class='cat-product-name'>${i.name} </div>
Run Code Online (Sandbox Code Playgroud)

爪哇脚本

  $(window).load(function () {
  var maxHeight = Math.max.apply(null, $("#div-height").map(function ()
                {
                    return $(this).height();
                }).get());
                alert(maxHeight);
});
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

我想找到 div 的最大高度并设置每个 div 的高度。

javascript jquery jsp jstl

2
推荐指数
1
解决办法
5798
查看次数

标签 统计

javascript ×2

jquery ×2

css ×1

html ×1

jsp ×1

jstl ×1