Creating s-shaped curve using css

后端 未结 3 703
[愿得一人]
[愿得一人] 2020-12-11 04:08

I want to create a curve as shown in below image using css.

I was trying something like this:

3条回答
  •  半阙折子戏
    2020-12-11 04:15

    You could make this using pure CSS if you so wished.

    Demo

    This uses a large box shadow to create the second curve:

    .wrap {
      position: relative;
      height: 400px;
      width: 100%;
      margin: 0 auto;
      max-width: 1024px;
    }
    .shape {
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      width: 50%;
      overflow: hidden;
      z-index: 10;
    }
    .shape:after {
      content: "";
      position: absolute;
      top: 10%;
      left: 0;
      width: 100%;
      height: 90%;
      border-radius: 0 50% 0 0;
      box-shadow: 0 0 0 999px lightgray;
    }
    .shape2 {
      position: absolute;
      top: 0;
      left: 50%;
      height: 100%;
      width: 50%;
      background: lightgray;
      border-radius: 0 0 0 50%;
      z-index: 10;
    }
    
    /******************************/
    
    html,
    body {
      margin: 0;
      padding: 0;
      height: 100%;
      vertical-align: top;
      overflow: hidden;
      background: cornflowerblue;
     
    }
    This will be where you can place the text to go down the right hand side of the slider

提交回复
热议问题