How to achieve adaptive width and height: the calculation attribute problem in CSS width:calc(100% - 200px)

When laying out the page, there will be a phenomenon that the left side is fixed and the right side is adaptive. At this time, you need to use the calc() function to calculate the attributes. (Height is also the same)

.right{
  float: left;
  height: 100%;
  width: calc(100% - 220px);
}

At this time, it should be noted that when calculating the function of the calc attribute, the operation symbols need to be separated by spaces before and after

Notice:

The spaces in this calc() function are significant, if there are no spaces, the property will be disabled.

calc(100% - 220px) , where the two red vertical lines are spaces.

Guess you like

Origin blog.csdn.net/m0_60237095/article/details/129620598