How to make a div fill a remaining horizontal space?

前端 未结 25 1464
野的像风
野的像风 2020-11-22 00:45

I have 2 divs: one in the left side and one in the right side of my page. The one in the left side has fixed width and I want the one of the right side to f

25条回答
  •  梦毁少年i
    2020-11-22 01:39

    I wonder that no one used position: absolute with position: relative

    So, another solution would be:

    HTML

    CSS

    header { position: relative;  }
    #left {
        width: 160px;
        height: 25px;
    }
    #right {
        position: absolute;
        top: 0px;
        left: 160px;
        right: 0px;
        height: 25px;
    }
    

    Jsfiddle example

提交回复
热议问题