Bootstrap4 make all input-group-addons same width

后端 未结 5 1996
遥遥无期
遥遥无期 2021-02-13 18:50

Is it possible to make all prepend add-ons same width?

i.e in this screenshot I would like Email, License Key 1 & License Key 2 to be the same length, is that possib

5条回答
  •  情书的邮戳
    2021-02-13 18:59

    Using jquery you could do something like this:

    var biggest = Math.max.apply(Math, $('.input-group-text').map(function(){ return $(this).width(); }).get());
    $('.input-group-text').width(biggest);
    

    Math.max.apply reads all .input-group-text widths and returns the biggest one. The next line applies this width to all .input-group-text divs.

    Sources: jquery-get-max-width-of-child-divs

提交回复
热议问题