Why height=100% doesn't work?

前端 未结 3 1944
心在旅途
心在旅途 2020-12-04 03:32

I use a third-party component that occupies all the available space, i.e. width=100% and height=100%. I don\'t have control over it.

I\'m t

3条回答
  •  無奈伤痛
    2020-12-04 03:53

    You can simply use another flex container in the .content element:

    .container {
      display: flex;
      flex-direction: column;
      width: 200px;
      height: 100px;
    }
    
    .header {
      display: flex;
      background-color: rgba(255, 0, 0, 0.5);
    }
    
    .content {
      flex-grow: 1;
      display: flex;
      flex-direction: column;
      background-color: rgba(0, 255, 0, 0.5);
    }
    
    .third-party-component {
      flex-grow: 1;
      height: 100%;
      width: 100%;
      background-color: rgba(0, 0, 255, 0.5);
    }
    Header
    Third party component

提交回复
热议问题