div超过移动设备上的最大高度

时间:2020-02-12 17:22:46

标签: css reactjs

你好,我在移动设备上的网格布局存在问题,基本上他超过了我不知道如何解决的最大高度:

enter image description here

代码:

 <Container>
      <Wrapper />
      <div style={{ background: "red", height: "500px", width: "100%" }}>a</div>
      <TestingLive>
        <div class="a">
          <span>a</span>
        </div>
        <div class="b">
          <span>b</span>
        </div>
        <div class="c">
          <span>c</span>
        </div>
        <div class="d">
          <span>d</span>
        </div>
        <div class="e">
          <span>e</span>
        </div>
      </TestingLive>
      <div style={{ background: "red", height: "500px", width: "100%" }}>a</div>
    </Container>

css:

const TestingLive = styled.div`
  display: grid;
  grid-template-areas:
    "a b c"
    "a d e";
  grid-gap: 4px;
  grid-template-columns: 40vw 1fr 1fr;
  height: 100%;
  max-height: 60vh;
  min-height: 60vh;
  margin-bottom: 10px;
  ${media.lessThan("medium")`
  grid-template-columns:1fr;
  grid-auto-rows: 200px;
  grid-template-areas:
  'a '
  'b'
  'c'
  'd'
  'e';
  `}

  margin-top: 50px;
  & > * {
    background-color: #333;
    color: white;
    position: relative;
  }

  & .a {
    grid-area: a;
  }

  & .b {
    grid-area: b;
  }

  & .c {
    grid-area: c;
  }

  & .d {
    grid-area: d;
  }

  & .e {
    grid-area: e;
  }
`;
const Container = styled.div`
  background: none;
  height: 100%;
  margin: 0 auto;
  max-width: 80rem !important;
  padding-right: 10px;
  padding-left: 10px;
`;
const Wrapper = styled.div`
  position: relative;
  width: 100%;
  padding-top: 128px;
  padding-bottom: 128px;
  box-sizing: border-box;
`;

基本上,我需要将移动卡都放在宽度为100%,高度为25的列中 但这超出了我的容器的最大高度

示例:

https://codesandbox.io/s/great-snowflake-4dwpy

0 个答案:

没有答案