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

表单包装器没有响应

  •  2
  • milan  · 技术社区  · 6 年前

    我试图设计的报名表将有两个不同的颜色和背景的双方,报名表应该正好在上述背景和中心。我可以设计我所解释的方式,但它不够灵敏。主要是在手机设计方面,进展并不顺利。对于移动设备,应该只有普通的注册表。可能是我在定位(相对,绝对)部分犯了错误。

    这就是我所做的

    html格式

    .signup-form {
      width: 100%;
      min-height: 100vh;
      display: -webkit-box;
      display: -webkit-flex;
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
      background: #f2f2f2;
    }
    
    .signup-wrapper {
      width: 100%;
      background: #6493f3;
      overflow: hidden;
      display: -webkit-box;
      display: -webkit-flex;
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      flex-wrap: wrap;
      align-items: stretch;
      flex-direction: row-reverse;
    }
    
    .left-block {
      width: calc(100% - 560px);
      background: #6493f3;
      background-repeat: no-repeat;
      background-size: cover;
      background-position: center;
      z-index: 1;
      &::before {
        content: '';
        display: block;
        position: absolute;
        z-index: -1;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.1);
      }
    }
    
    .right-block {
      width: 560px;
      min-height: 100vh;
      display: block;
      background-color: #f7f7f7;
      padding: 50px 55px 55px 55px;
      position: relative;
    }
    
    form {
      background: #fff;
      box-shadow: 0 1.5px 0 0 rgba(0, 0, 0, 0.1);
      position: absolute;
      top: 120px;
      left: -100px;
      width: 450px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      padding: 20px;
    }
    
    .caption {
      width: 100%;
      display: flex;
      font-size: 30px;
      color: #444;
      line-height: 1.2;
      text-align: center;
      padding: 20px;
      flex: 1;
      justify-content: center;
      align-items: center;
    }
    
    .form-field {
      display: -webkit-box;
      display: -webkit-flex;
      display: -ms-flexbox;
      display: flex;
      margin-bottom: 2rem;
    }
    <div class="signup-form">
      <div class="signup-wrapper">
        <div class="right-block">
          <form>
            <span class="caption">Create An Account</span>
            <div class="form-field">
              <input type="text" placeholder="full name" />
            </div>
            <div class="form-field">
              <input type="email" placeholder="email" />
            </div>
            <div class="form-field">
              <input type="password" placeholder="password" />
            </div>
            <div class="form-field">
              <input type="text" placeholder="country" />
            </div>
          </form>
        </div>
        <div class="left-block">
        </div>
      </div>
    </div>

    http://jsbin.com/ritinedeku/1/edit?html,css

    更新

    这就是我想要达到的目标。

    enter image description here

    1 回复  |  直到 6 年前
        1
  •  1
  •   Waqar    6 年前

    .signup-form { 
      width: 100%;
      min-height: 100vh;
      display: -webkit-box;
      display: -webkit-flex;
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
      background: #f2f2f2;
    }
    
    
    .signup-wrapper{
      width: 100%;
      background: #6493f3;
      overflow: hidden;
      display: -webkit-box;
      display: -webkit-flex;
      display: -moz-box;
      display: -ms-flexbox;
      display: flex;
      flex-wrap: wrap;
      align-items: stretch;
      flex-direction: row-reverse;
    }
    
    .left-block{
      width: calc(100% - 560px);
      background: #6493f3;
      background-repeat: no-repeat;
      background-size: cover;
      background-position: center;
      z-index: 1;
      &::before {
        content: '';
        display: block;
        position: absolute;
        z-index: -1;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.1);
      }
    }
    
    .right-block{
      width: 50%;
      min-height: 100vh;
      display: block;
      background-color: #f7f7f7;
      padding: 0;
      position: relative;
    }
    
    form {
            background: #fff;
    box-shadow: 0 1.5px 0 0 rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 120px;
    left: 0;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    z-index: 99;
    right: 0;
    margin: auto;
    width: 75%;
    }
    
    .caption {
      width: 100%;
      display: flex;
      font-size: 30px;
      color: #444;
      line-height: 1.2;
      text-align: center;
      padding: 20px;
      flex: 1;
      justify-content: center;
      align-items: center;
    }
    
    .form-field {
      display: -webkit-box;
      display: -webkit-flex;
      display: -ms-flexbox;
      display: flex;
      margin-bottom: 2rem;
    }
    <div class="signup-form">
      <div class="signup-wrapper">
         <form>
            <span class="caption">Create An Account</span>
            <div class="form-field">
              <input type="text" placeholder="full name" />
            </div>
            <div class="form-field">
              <input type="email" placeholder="email" />
            </div>
            <div class="form-field">
              <input type="password" placeholder="password" />
            </div>
            <div class="form-field">
              <input type="text" placeholder="country" />
            </div>
          </form>
        <div class="right-block">
         
        </div>
        <div class="left-block">
        </div>
      </div>
    </div>