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

前端 未结 18 839
借酒劲吻你
借酒劲吻你 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:41

    You need to have a container for your content div that you wish to be 100% - 100px

    #container {
       width: 100%
    }
    #content {
       margin-right:100px;
       width:100%;
    }
    
    
    Your content here

    You might need to add a clearing div just before the last

    if your content div is overflowing.

     

提交回复
热议问题