2017-09-01 9 views
1

背景に背景画像があり、2つの入力フィールド(ユーザー名、パスワード)と2つのボタン(コード内のクラス名= .explore)(ログインとホーム)。

2つの入力フィールドが並べて表示されています。

しかし、テキストフィールドは別のものの上に配置されていますが、私はスタイルのようなコンテンツを望んでいますが、solを見つけることができません。ボタンのmycodeが正しくても、モーダルページのボタンも表示されていなくても。

.ab { 
 
       width: 320px; 
 
       margin: 45px auto; 
 
      } 
 

 
    .ab hr.sep { 
 
       background: #2196F3; 
 
       box-shadow: none; 
 
       border: none; 
 
       height: 2px; 
 
       width: 25%; 
 
       margin: 0px auto 45px auto; 
 
      } 
 
    .ab .emoji { 
 
       font-size: 1.2em; 
 
      } 
 

 
     .group { 
 
       position: relative; 
 
      display: contents; 
 
      padding-top: 10px; 
 
      margin: 45px 0; 
 
      } 
 

 

 
     input{ 
 

 
       background: none; 
 
       color: #c6c6c6; 
 
       font-size: 18px; 
 
       padding: 10px 10px 10px 5px; 
 
       display: block; 
 
       width: 320px; 
 
       border: none; 
 
       border-radius: 0; 
 
       border-bottom: 1px solid #c6c6c6; 
 
      } 
 
    input:focus, 
 
    textarea:focus { 
 
       outline: none; 
 
      } 
 
     input:focus ~ label, input:valid ~ label, 
 
     textarea:focus ~ label, 
 
    textarea:valid ~ label { 
 
       top: -14px; 
 
       font-size: 12px; 
 
       color: orangered; 
 
      } 
 
    input:focus ~ .bar:before, 
 
    textarea:focus ~ .bar:before { 
 
       width: 320px; 
 
      } 
 

 
    input[type="password"] { 
 
       letter-spacing: 0.3em; 
 
      } 
 

 
    label { 
 
       color: #c6c6c6; 
 
       font-size: 16px; 
 
       font-weight: normal; 
 
       position: absolute; 
 
       pointer-events: none; 
 
       left: 5px; 
 
       top: 10px; 
 
       -webkit-transition: 300ms ease all; 
 
       transition: 300ms ease all; 
 
      } 
 

 
    .bar { 
 
       position: relative; 
 
       display: block; 
 
       width: 320px; 
 
      } 
 
    .bar:before { 
 
       content: ''; 
 
       height: 2px; 
 
       width: 0; 
 
       bottom: 0px; 
 
       position: absolute; 
 
       background: #2196F3; 
 
       -webkit-transition: 300ms ease all; 
 
       transition: 300ms ease all; 
 
       left: 0%; 
 
      } 
 

 
     .explore { 
 
       font-family: 'Space Mono', monospace; 
 
       letter-spacing: 8px; 
 
       background: none; 
 
       color: floralwhite; 
 
       position: absolute; 
 
       outline: none; 
 
       border: none; 
 
       height: 50px; 
 
       width: 190px; 
 
       left: 50px;; 
 
       font-size: 20px; 
 
       z-index: 2; 
 
       -webkit-transition: .01s .23s ease-out all; 
 
       transition: .01s .23s ease-out all; 
 
       overflow: hidden; 
 
      margin: 30px; 
 
      } 
 
     .explore:before { 
 
       content: ''; 
 
       position: absolute; 
 
       left: 0; 
 
       top: 0; 
 
       height: 100%; 
 
       width: 55%; 
 
       background: #000000; 
 
       z-index: -1; 
 
       -webkit-transition: .3s ease-in all; 
 
       transition: .3s ease-in all; 
 
      } 
 
     .explore:after { 
 
       content: ''; 
 
       position: absolute; 
 
       left: -5%; 
 
       top: 5%; 
 
       height: 90%; 
 
       width: 5%; 
 
       background: white; 
 
       z-index: -1; 
 
       -webkit-transition: .4s .02s ease-in all; 
 
       transition: .4s .02s ease-in all; 
 
      } 
 
     .explore:hover { 
 
       cursor: pointer; 
 
       color: transparent; 
 
      } 
 
     .explore:hover:before { 
 
       left: 100%; 
 
       width: 25%; 
 
      } 
 
     .explore:hover:after { 
 
       left: 100%; 
 
       width: 70%; 
 
      } 
 
     .explore:hover .icon-right.after:after { 
 
       left: -80px; 
 
       color: white; 
 
       -webkit-transition: .2s .2s ease all; 
 
       transition: .2s .2s ease all; 
 
      } 
 
     .explore:hover .icon-right.after:before { 
 
       left: -104px; 
 
       top: 14px; 
 
       opacity: 0.2; 
 
       color: white; 
 
      } 
 

 
     .icon-right { 
 
       position: absolute; 
 
       top: 0; 
 
       right: 0; 
 
      } 
 
     .icon-right:after { 
 
       font-family: "FontAwesome"; 
 
       content: '\2192'; 
 
       font-size: 24px; 
 
       display: inline-block; 
 
       position: relative; 
 
       top: 26px; 
 
       -webkit-transform: translate3D(0, -50%, 0); 
 
         transform: translate3D(0, -50%, 0); 
 
      } 
 
     .icon-right.after:after { 
 
       left: -250px; 
 
       color: orangered; 
 
       -webkit-transition: .15s .25s ease left, .5s .05s ease color; 
 
       transition: .15s .25s ease left, .5s .05s ease color; 
 
      } 
 
     .icon-right.after:before { 
 
       content: 'LogIN'; 
 
       position: absolute; 
 
       left: -230px; 
 
       top: 14px; 
 
       opacity: 0; 
 
       -webkit-transition: .2s ease-in all; 
 
       transition: .2s ease-in all; 
 
      } 
 

 

 

 
.my_modal{ 
 
      display: none;  /* Hidden by default */ 
 
      position: fixed; /* Stay in place */ 
 
      z-index: 1;   /* Sit on top */ 
 
      padding-top: 100px; /* Location of the box */ 
 
      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.4); /* Black w/ opacity */ 
 
     } 
 
     .modal-animated{ 
 
      background-image: url(maxresdefaultx.jpg); 
 
      height: 100%; 
 
      width: 50%; 
 
      background-color: #fefefe; 
 
      padding: 20px; 
 
      border: 1px solid #888; 
 
      margin:5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */ 
 
     } 
 
.close{ 
 
      position: absolute; 
 
      right: 25px; 
 
      top: 0; 
 
      color: aqua; 
 
      font-size: 35px; 
 
      font-weight: bold; 
 
     } 
 
     .close:hover, 
 
     .close:focus{ 
 
      color: red; 
 
      cursor: pointer; 
 
     } 
 
     .image-container{     
 
      background-size: cover; 
 
      height: 300px; 
 
      text-align: center; 
 
      margin: 24px 0 12px 0; 
 
      position: relative; 
 
     } 
 
     image.avatar{ 
 
      width: 40%; 
 
      border-radius: 60%; 
 
      
 
     } 
 
<div id= "id01" class="my_modal"> 
 
     <form class="modal-animated animate" action="actionpahe.php"> 
 
     <div class="image-container"> 
 
      <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">&times;</span> 
 
      <img src="avatar-05.png" alt="Avatar" class="avatar"> 
 
      
 
     <div class="contents"> 
 
     <div class="ab"> 
 
    
 
    
 
      <hr class="sep"/> 
 
      <div class="group"> 
 
      <input type="text" required="required"/><span class="highlight"></span><span class="bar"></span> 
 
      <label>Name</label> 
 
      <br> 
 
      <br> 
 
      
 
      <input type="password" required="required"/><span class="highlight"></span><span class="bar"></span> 
 
      <label>Password</label> 
 
      
 
      </div> 
 
      
 

 
      <button class="explore">Login 
 
       <span class="icon-right"></span> 
 
       <span class="icon-right after"></span> 
 
      </button> 
 

 
      <button class="explore">Home 
 
       <span class="icon-right"></span> 
 
       <span class="icon-right after"></span> 
 
      </button> 
 
     
 
    </div> 
 
      
 
      </div> 
 
     </div> 
 
     </form> 
 
    </div>

答えて

0

パスワードのテキストフィールドにユーザー名テキストフィールドとは異なる場所を与えてみてください。両方のテキストフィールドが表示される場所にピクセル値を移動するかどうかを調べるには、ピクセル値を使います。

あなたのCSSでこれを追加してみてください:

input[type="password"] { top: 20px; } 
関連する問題