2017-09-19 4 views
0

私のオプションclass divを、私の登録クラスdivに従うように、私の登録クラスdivがmain-headingクラスdivに従うようにします。なんらかの理由で、オプションclass divは登録クラスdivの下に浮かんでいます。誰かがこれに対応する解決策を提供できますか? 私のオプションクラスdivが私の登録クラスdivのすぐ下に表示されない理由についての説明は非常に義務付けられています。それは子供たちがその60%60%を取ることを意味しますので、理由はあなたのクラスregistrationdiv要素がトップクラスに従うようにする

html, body { 
 
    height: 100%; 
 
} 
 
.col-1 {width: 8.33%;} 
 
.col-2 {width: 16.66%;} 
 
.col-3 {width: 25%;} 
 
.col-4 {width: 33.33%;} 
 
.col-5 {width: 41.66%;} 
 
.col-6 {width: 50%;} 
 
.col-7 {width: 58.33%;} 
 
.col-8 {width: 66.66%;} 
 
.col-9 {width: 75%;} 
 
.col-10 {width: 83.33%;} 
 
.col-11 {width: 91.66%;} 
 
.col-12 {width: 100%;} 
 

 
[class*="col-"] { 
 
    float: left; 
 
    padding: 15px; 
 
    border: 1px solid red; 
 
} 
 
.row::after { 
 
    content: ""; 
 
    clear: both; 
 
    display: table; 
 
} 
 

 
* { 
 
    box-sizing: border-box; 
 
} 
 
.header { 
 
    background-color: black; 
 
    color: white; 
 
    padding: 5px 20px 5px 5px; 
 
    margin-top: 0; 
 
    text-align: right; 
 

 
} 
 

 
a { 
 
    color: white; 
 
    text-decoration: none; 
 
} 
 

 
.row { 
 
    height: 100%; 
 
    border-color: red; 
 
} 
 

 
.footer { 
 
    height: 25%; 
 
} 
 

 
.top-space { 
 
    height: 25%; 
 
} 
 

 
.middle { 
 
    height:150%; 
 
} 
 

 
.left-aside { 
 
    height: 100%; 
 
} 
 

 
.main { 
 
    height: 100%; 
 
    padding: 0; 
 
    margin: 0; 
 
} 
 

 
.right-aside { 
 
    height: 100%; 
 
} 
 

 
.main-heading { 
 
    height: 3%; 
 
    margin: 0; 
 
} 
 

 
.registration { 
 
    height: 60%; 
 
    margin: 0; 
 
} 
 

 
.options { 
 
    height: 50%; 
 
    margin: 0; 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
    <script src="https://code.jquery.com/jquery-2.1.0.js"></script> 
 
    <link rel="stylesheet" type="text/css" href="css/style.css"> 
 
    <script language="JavaScript" type="text/javascript" src="js/indexController.js"></script> 
 
    <meta charset="UTF-8"> 
 
    <title>Title</title> 
 
</head> 
 
<body> 
 

 
    <div class="header"> 
 
     <span><a href="#">Login</a> | <a href="#">Countries</a></span> 
 
    </div> 
 

 
    <div class="row top-space"> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
     <div class="col-9" style="height: 100%"> 
 
     </div> 
 
    </div> 
 

 
    <div class="row middle"> 
 
     <div class="col-3 left-aside"> 
 
     </div> 
 
     <div class="col-6 main"> 
 
      <div class="row main-heading"> 
 
       <div class="col-2"> 
 
       </div> 
 
       <div class="col-2"> 
 
       </div> 
 
       <div class="col-2"> 
 
       </div> 
 
       <div class="col-2"> 
 
       </div> 
 
       <div class="col-4"> 
 
       </div> 
 
      </div> 
 
      <div class="row registration"> 
 
       <div class="col-6 registration"> 
 
       </div> 
 
       <div class="col-6 registration"> 
 
       </div> 
 
      </div> 
 
      <div class="row options"> 
 
       <div class="col-12 options"> 
 
       </div> 
 
      </div> 
 
     </div> 
 
     <div class="col-3 right-aside"> 
 
     </div> 
 
    </div> 
 

 
    <div class="row footer"> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
    </div> 
 

 
</body> 
 
</html>

+0

で子供たちに別のクラスを与えるあなたは少し問題をより明確にもらえますか?どのように「付着する」という意味ですか? – sol

+0

境界線のない最上部に貼り付けます。 –

答えて

1

それは次のように起こり、親と子の上に、2回使用されています。だから、100%の高さ

.registration-item { 
    height: 100; 
    margin: 0; 
} 

html, body { 
 
    height: 100%; 
 
} 
 
.col-1 {width: 8.33%;} 
 
.col-2 {width: 16.66%;} 
 
.col-3 {width: 25%;} 
 
.col-4 {width: 33.33%;} 
 
.col-5 {width: 41.66%;} 
 
.col-6 {width: 50%;} 
 
.col-7 {width: 58.33%;} 
 
.col-8 {width: 66.66%;} 
 
.col-9 {width: 75%;} 
 
.col-10 {width: 83.33%;} 
 
.col-11 {width: 91.66%;} 
 
.col-12 {width: 100%;} 
 

 
[class*="col-"] { 
 
    float: left; 
 
    padding: 15px; 
 
    border: 1px solid red; 
 
} 
 
.row::after { 
 
    content: ""; 
 
    clear: both; 
 
    display: table; 
 
} 
 

 
* { 
 
    box-sizing: border-box; 
 
} 
 
.header { 
 
    background-color: black; 
 
    color: white; 
 
    padding: 5px 20px 5px 5px; 
 
    margin-top: 0; 
 
    text-align: right; 
 

 
} 
 

 
a { 
 
    color: white; 
 
    text-decoration: none; 
 
} 
 

 
.row { 
 
    height: 100%; 
 
    border-color: red; 
 
} 
 

 
.footer { 
 
    height: 25%; 
 
} 
 

 
.top-space { 
 
    height: 25%; 
 
} 
 

 
.middle { 
 
    height:150%; 
 
} 
 

 
.left-aside { 
 
    height: 100%; 
 
} 
 

 
.main { 
 
    height: 100%; 
 
    padding: 0; 
 
    margin: 0; 
 
} 
 

 
.right-aside { 
 
    height: 100%; 
 
} 
 

 
.main-heading { 
 
    height: 3%; 
 
    margin: 0; 
 
} 
 

 
.registration { 
 
    height: 60%; 
 
    margin: 0; 
 
} 
 

 
.options { 
 
    height: 50%; 
 
    margin: 0; 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
    <script src="https://code.jquery.com/jquery-2.1.0.js"></script> 
 
    <link rel="stylesheet" type="text/css" href="css/style.css"> 
 
    <script language="JavaScript" type="text/javascript" src="js/indexController.js"></script> 
 
    <meta charset="UTF-8"> 
 
    <title>Title</title> 
 
</head> 
 
<body> 
 

 
    <div class="header"> 
 
     <span><a href="#">Login</a> | <a href="#">Countries</a></span> 
 
    </div> 
 

 
    <div class="row top-space"> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
     <div class="col-9" style="height: 100%"> 
 
     </div> 
 
    </div> 
 

 
    <div class="row middle"> 
 
     <div class="col-3 left-aside"> 
 
     </div> 
 
     <div class="col-6 main"> 
 
      <div class="row main-heading"> 
 
       <div class="col-2"> 
 
       </div> 
 
       <div class="col-2"> 
 
       </div> 
 
       <div class="col-2"> 
 
       </div> 
 
       <div class="col-2"> 
 
       </div> 
 
       <div class="col-4"> 
 
       </div> 
 
      </div> 
 
      <div class="row registration" style="background-color: deeppink;"> 
 
       <div class="col-6 registration" style="background-color: deepskyblue;"> 
 
       </div> 
 
       <div class="col-6 registration"> 
 
       </div> 
 
      </div> 
 
      <div class="row options"> 
 
       <div class="col-12 options" style="background-color: deepskyblue;"> 
 
       </div> 
 
      </div> 
 
     </div> 
 
     <div class="col-3 right-aside"> 
 
     </div> 
 
    </div> 
 

 
    <div class="row footer"> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
     <div class="col-3" style="height: 100%"> 
 
     </div> 
 
    </div> 
 

 
</body> 
 
</html>

+0

'.options'と同じことが言えます。 – hungerstar

関連する問題