2017-03-26 4 views
2

私は下の画像のようにしようとしましたが、できません。彼は右のか、大きなCOLここ-.-私の画像のようなフレックスグリッド

Grid System Picture I Want

下に置く 毎回が私のコードです:

.row { 
 
    margin-top: 0.5rem; 
 
    display: flex; 
 
    flex-direction: row; 
 
    flex-wrap: wrap; 
 
} 
 

 
.col { 
 
    flex: 1 1 8%; 
 
    margin: 0 0 0.5rem 0; 
 
    padding: 0.5em 10px; 
 
    box-sizing: border-box; 
 
} 
 

 
/* nested grids */ 
 
.row .row, .row.nested { 
 
    flex: 1 1 auto; 
 
    margin-top: -0.5em; 
 
} 
 

 
/* full width grids */ 
 
.row.wide-fit { 
 
    margin-left: -10px; 
 
    margin-right: -10px; 
 
} 
 

 
/* center grids */ 
 
.row.center { 
 
    justify-content: center; 
 
} 
 

 
.center .col { 
 
    flex-grow: 0; 
 
    flex-shrink: 0; 
 
} 
 

 
/* columns widths */ 
 

 
.col-span-1 { 
 
    flex-basis: 8.3333%; 
 
} 
 

 
.col-span-2 { 
 
    flex-basis: 16.6666%; 
 
} 
 

 
.col-span-3 { 
 
    flex-basis: 25%; 
 
} 
 

 
.col-span-4 { 
 
    flex-basis: 33.3333%; 
 
} 
 

 
.col-span-5 { 
 
    flex-basis: 41.6666%; 
 
} 
 

 
.col-span-6 { 
 
    flex-basis: 50%; 
 
} 
 

 
.col-span-7 { 
 
    flex-basis: 58.3333%; 
 
} 
 

 
.col-span-8 { 
 
    flex-basis: 66.6666%; 
 
} 
 

 
.col-span-9 { 
 
    flex-basis: 75%; 
 
} 
 

 
.col-span-10 { 
 
    flex-basis: 83.3333%; 
 
} 
 

 
.col-span-11 { 
 
    flex-basis: 91.6666%; 
 
} 
 

 
.col-span-12 { 
 
    flex-basis: 100%; 
 
} 
 

 
/* examples */ 
 

 
.fixed-width { 
 
    flex: 0 0 500px; 
 
    background-color: rgba(255,0,0,0.1) !important; 
 
} 
 

 
@media all and (max-width: 568px) { 
 
    .col-span-1, 
 
    .col-span-2, 
 
    .col-span-3, 
 
    .col-span-4, 
 
    .col-span-5 { 
 
    flex-basis: 50%; 
 
    } 
 

 
    .col-span-6, 
 
    .col-span-7, 
 
    .col-span-8, 
 
    .col-span-9, 
 
    .col-span-10, 
 
    .col-span-11 { 
 
    flex-basis: 100%; 
 
    } 
 

 
    .nested .col { 
 
    flex-basis: 100%; 
 
    } 
 
    
 
} 
 

 
/* eye candy */ 
 

 
body { 
 
    font-family: sans-serif; 
 
} 
 

 
.row { 
 
    background-color: #cccccc; 
 
    background-color: rgba(0,0,0,0.1); 
 
} 
 
.col { 
 
    background-color: #999999; 
 
    background-color: rgba(0,0,0,0.2); 
 
    background-clip: content-box; 
 
    border: 1px solid rgba(0,0,0,0.1); 
 
}
<html lang="en"> 
 
<head> 
 
    <meta charset="UTF-8"> 
 
    <title>Flexbox Grid System</title> 
 
    <link rel="stylesheet" href="css/fb-grid.css"> 
 
</head> 
 
<body> 
 

 
<div class="row"> 
 
\t <div class="col col-span-8">1</div> 
 
\t <div class="col col-span-2">2</div> 
 
\t <div class="col col-span-2">3</div> 
 
    <div class="col col-span-4">4</div> 
 
    <div class="col col-span-4">5</div> 
 
    <div class="col col-span-4">6</div> 
 
</div> 
 

 
\t 
 
</body> 
 
</html>

誰もが何か提案がありますか?

+0

のように見えますが、あなたは何をしようとしているのだろうか?解決しようとしている正確なコーディングの問題を指定してください。スタックオーバーフローは無料のコーディングサービスではありません – grizzthedj

+0

どのブートストラップバージョンを使用していますか?固定された高さの列が欲しいですか? – neophyte

+0

先頭のdivラッパーで 'min-height'を試しましたか? – Umair

答えて

1

HTMLコード

<html lang="en"> 
    <head> 
     <meta charset="UTF-8"> 
     <title>Flexbox Grid System</title> 
     <link rel="stylesheet" href="css/fb-grid.css"> 
    </head> 
    <body> 
     <div class="row"> 
     <div class="col col-span-8">1</div> <!-- give required height--> 
     <div class="col col-span-4"> 
      <div class="col col-span-12">2</div><!--code change--> 
      <div class="col col-span-12">3</div><!--code change--> 
     </div> 
     <div class="col col-span-4">4</div> 
     <div class="col col-span-4">5</div> 
     <div class="col col-span-4">6</div> 
    </div> 


    </body> 
    </html> 
+1

ありがとう、私はそれが別の方法を与えたと思いますが、これは大丈夫です:) –

+0

あなたはようこそ!あなたが見つけた別の方法は? –

関連する問題