Align width of container div to the sum of floating div

后端 未结 5 808
说谎
说谎 2021-02-14 17:27

I have the following html:

wookie1
5条回答
  •  梦毁少年i
    2021-02-14 17:56

    I got bored trying this and created a JS script based on jQuery to solve it.

    var t = $(".sub_container").width()/$(".floating").outerWidth();
    $(".sub_container").width(parseInt(t) * $(".floating").outerWidth());
    

    Demo

提交回复
热议问题