代码之家  ›  专栏  ›  技术社区  ›  OM The Eternity

HTML/CSS:在模式框顶部以半圆显示图像

  •  0
  • OM The Eternity  · 技术社区  · 6 年前

    Expected Design Design distortion on validation message

    .modal {
      font-family: Avenir-Medium;
      font-size: 16px;
      font-weight: 900;
      font-style: normal;
      font-stretch: normal;
      display: block;
      /*Hidden by default */
      position: fixed;
      /* Stay in place */
      z-index: 1;
      /* Sit on top */
      left: 0;
      top: 0;
      width: 100%;
      /* Full width */
      height: 100%;
      /* Full height */
      overflow: auto;
      /* Enable scroll if needed */
      background-color: rgb(0, 0, 0);
      /* Fallback color */
      background-color: rgba(0, 0, 0, 0.3);
      /* Black w/ opacity */
      -webkit-animation-name: slideIn;
      /* Fade in the background */
      -webkit-animation-duration: 2.0s;
      /* Fade in the background */
      ;
    }
    
    
    /* Modal Content */
    
    .modal-content {
      position: fixed;
      bottom: 0;
      background-color: #fefefe;
      width: 92%;
      left: 14px;
      -webkit-animation-name: fadeIn;
      -webkit-animation-duration: 0.5s;
      border-radius: 16px 16px 0px 0px;
      -webkit-box-shadow: none;
      -moz-box-shadow: none;
      box-shadow: none;
      border: none;
      top: auto;
    }
    
    .modal-wrapper {
      line-height: 45px;
      border: 1px solid #e7e9ea;
      border-radius: 6px 6px 0px 0px;
      background-color: white;
      margin: auto;
    }
    
    .modal-wrapper::after {
      background: url("../../../../images/mobile/img-payment_38.png") no-repeat 22px 10px;
      background-size: 50%;
      background-color: #fff;
      content: '';
      width: 78px;
      height: 45px;
      position: absolute;
      left: 0;
      right: 0;
      margin: auto;
      border-radius: 78px 78px 0 0;
      border-left: 1px solid #e7e9ea;
      border-top: 1px solid #e7e9ea;
      border-right: 1px solid #e7e9ea;
      border-bottom: 3px solid white;
      bottom: 300px;
    }
    
    .close-btn {
      position: absolute;
      vertical-align: top;
      top: 4px;
      left: 320px;
      width: 18px;
      height: 18px;
    }
    
    .container-div-creditCard {
      margin: 12px 20px 0px 20px;
    }
    
    .container-div-creditCard>img {
      position: absolute;
      bottom: 154px;
      right: 30px;
    }
    
    .credit-card-modal-label {
      font-family: AvenirHeavy;
      font-size: 13px;
      color: #1d3444;
      text-align: center;
      font-weight: 200;
      height: 24px;
      margin-left: 31px;
    }
    
    .input-modal {
      width: 100%;
      height: 44px;
    }
    
    .input-spacing {
      margin-top: 15px;
    }
    
    .credit-input-modal {
      border: solid 1px #e7e9ea;
      border-radius: 5px;
      font-family: Avenir-Book;
      font-size: 14px;
      font-weight: normal;
      color: #8589a1;
      line-height: initial;
      padding: 13px 42px 12px 15px;
    }
    
    .credit-expiry-input-modal {
      padding: 13px 27px 12px 10px;
      border: solid 1px #e7e9ea;
      border-radius: 5px;
      font-family: Avenir-Book;
      font-size: 14px;
      font-weight: normal;
      color: #8589a1;
      display: inline-block;
      line-height: initial;
      width: 65%;
      height: 44px;
    }
    
    .credit-cvc-input-modal {
      width: 30%;
      padding: 17px 5px 12px 10px;
      border: solid 1px #e7e9ea;
      border-radius: 5px;
      font-family: Avenir-Book;
      font-size: 14px;
      font-weight: normal;
      color: #8589a1;
      line-height: initial;
      height: 44px;
    }
    
    .cvvDisc {
      -webkit-text-security: disc;
    }
    
    .credit-submit-button {
      width: 100%;
      padding: 13px;
      margin-top: 15px;
      border: solid 1px #e7e9ea;
      border-radius: 5px 5px 5px 5px;
      background: linear-gradient(to right, #e32490, #ed1a3d);
      color: white;
      margin-bottom: 20px;
      font-family: Avenir-Book;
      font-weight: normal;
      font-size: 14px;
      line-height: initial;
    }
    
    .errorMsg {
      font-family: Avenir-Book;
      font-weight: normal;
      color: #ED1A3D;
      font-size: 12px;
    }
    <div id="modalCCDetails" class="modal">
      <div class="modal-content modal-wrapper">
        <div class="container-div-creditCard">
          <label class="credit-card-modal-label">ENTER YOUR CREDIT CARD DETAILS</label>
          <input name="cc_name" class="input-modal credit-input-modal" type="text" placeholder="Name printed on Credit Card" onChange={this.handleUserInput} />
          <span class="errorMsg"></span>
          <input name="cc_number" class="input-modal credit-input-modal input-spacing" type="tel" maxLength="16" onKeyPress={(e)=> this.handleCCOnKeyPress(e)} placeholder="16 digit credit card number" />
          <span class="errorMsg"></span>
          <input name="cc_expDate" class="credit-expiry-input-modal" type="text" placeholder="Expiry MM-YYYY" />
          <div class="device-divider" />
          <input name="cc_cvc" class="credit-cvc-input-modal cvvDisc" type="tel" placeholder="CVC" maxLength="3" />
          <span class="errorMsg"></span>
        </div>
        <button class="credit-submit-button">Submit Payment</button>
      </div>
    </div>
    </div>

    注: 这是手机视图截图

    2 回复  |  直到 6 年前
        1
  •  0
  •   Dharmesh Vekariya    6 年前

    只需将css代码调整为如下所示:

    .modal-wrapper::after {
      background: url("../../../../images/mobile/img-payment_38.png") no-repeat 22px 10px;
      background-size: 50%;
      background-color: #fff;
      content: '';
      width: 78px;
      height: 45px;
      position: absolute;
      left: 0;
      right: 0;
      margin: auto;
      border-radius: 78px 78px 0 0;
      border: 1px solid  #e7e9ea;
      border-bottom: 3px`enter code here` solid white;
      top: -48px;
    }
    

    只需移除底部:300px;并替换为顶部:-48px;或任何您想要的值。

        2
  •  1
  •   Huy Nguyen    6 年前

    请加上 top:-15px; bottom:300px; 课堂上 .modal-wrapper::after { top: -15px; } ,您将看到图像向上移动