How to place two divs side by side where one sized to fit and other takes up remaining space?

后端 未结 3 1801
被撕碎了的回忆
被撕碎了的回忆 2021-01-02 01:58

This should be easy... why is this not easy?

I am looking to have 2 divs side by side, where one div will auto size to the content inside and the second div will si

3条回答
  •  别那么骄傲
    2021-01-02 02:03

    you can use jQuery and code like this:

    $(document).ready(function() {
        redraw();
    });
    
    $(window).resize(function() {
        redraw();
    });
    
    function redraw()
    {
        var full_width = $('body').width();
        var left_width = $('.left_part').width();
        $('.right_part').width(full_width - left_width );
    }
    

    http://jsfiddle.net/gMxWc/62/ - here is working example

提交回复
热议问题