Setting div width to 100% minus certain amount of px

后端 未结 5 1417
执笔经年
执笔经年 2020-12-31 18:40

Have been searching the net for the past hours to find a solution to this, but couldn\'t find it, so here I am.

I need the width of the div to be

5条回答
  •  离开以前
    2020-12-31 19:32

    ...
    ...
    more content
    #left {float: left; width: 390px; background: #f76922;} #content {overflow: hidden; background: #eee;}

    float the left div and make a new block formatting context out of the right div (overflow: hidden is one way to do that), that way it will take the remaining space

    Example Fiddle

提交回复
热议问题