Div width 100% minus fixed amount of pixels

后端 未结 10 2070
猫巷女王i
猫巷女王i 2020-11-28 17:57

How can I achieve the following structure without using tables or JavaScript? The white borders represent edges of divs and aren\'t relevant to the question.

10条回答
  •  爱一瞬间的悲伤
    2020-11-28 18:26

    New way I've just stumbled upon: css calc():

    .calculated-width {
        width: -webkit-calc(100% - 100px);
        width:    -moz-calc(100% - 100px);
        width:         calc(100% - 100px);
    }​
    

    Source: css width 100% minus 100px

提交回复
热议问题