How can I do width = 100% - 100px in CSS?

前端 未结 18 868
借酒劲吻你
借酒劲吻你 2020-12-12 13:28

In CSS, how can I do something like this:

width: 100% - 100px;

I guess this is fairly simple but it is a bit hard to find examples showing

18条回答
  •  一个人的身影
    2020-12-12 13:46

    Modern browsers now support the:

    width: calc(100% - 100px);
    

    To see the list of supported browser versions checkout: Can I use calc() as CSS unit value?

    There is a jQuery fallback: css width: calc(100% -100px); alternative using jquery

提交回复
热议问题