代码之家  ›  专栏  ›  技术社区  ›  Run

向内弯曲的边界半径?[副本]

  •  3
  • Run  · 技术社区  · 8 年前

    header {
      position: relative;
      height: 300px;
      background-image: linear-gradient(#ff9d2f, #ff6126);
      border-bottom-left-radius: 50% 20%;
      border-bottom-right-radius: 50% 20%;
    }
    
    h1 {
      margin: 0;
      padding: 100px 0;
      font: 44px "Arial";
      text-align: center;
    }
    
    header h1 {
      color: white;
    }
    <header>
      <h1>Header Content</h1>
    </header>
    
    <section>
      <h1>Section Content</h1>
    </section>

    我希望它向内弯曲,可能吗?

    2 回复  |  直到 8 年前
        1
  •  3
  •   LKG    8 年前

    如以下示例所示

    header {
      position: relative;
      height: 300px;
      background-image: linear-gradient(#ff9d2f, #ff6126);
    }
    
    h1 {
      margin: 0;
      padding: 100px 0;
      font: 44px "Arial";
      text-align: center;
    }
    
    header h1 {
      color: white;
    }
    
    header:after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      height: 30%;
      width: 100%;
      background: #fff;
      border-top-left-radius: 50% 20%;
      border-top-right-radius: 50% 20%;
      user-select: none;
    }
    <header>
      <h1>Header Content</h1>
    </header>
    
    <section>
      <h1>Section Content</h1>
    </section>
        2
  •  1
  •   Gerard    8 年前

    header {
      position: relative;
      height: 300px;
      background-image: linear-gradient(#ff9d2f, #ff6126);
    }
    
    header:after {
      content: " ";
      width: 100%;
      height: 100px;
      position: absolute;
      background-color: white;
      bottom: 0;
      border-top-left-radius: 50% 40%;
      border-top-right-radius: 50% 40%;
    }
    
    h1 {
      margin: 0;
      padding: 100px 0;
      font: 44px "Arial";
      text-align: center;
    }
    
    header h1 {
      color: white;
    }
    <header>
      <h1>Header Content</h1>
    </header>
    
    <section>
      <h1>Section Content</h1>
    </section>