2016-08-29 6 views
0

グループ化された表データが必要です。 等しい幅のすべてのセルを求めました。以下のコードを参考にしてください。グループ化されたdivを持つdivでテーブル構造を取得する

.details { 
 
     display: table; 
 
     width: 100%; 
 
    } 
 
    .row { 
 
     display: table-row; 
 
    } 
 
    .cell1, .cell2, .cell3 { 
 
     width: 100%; 
 
     display: table-cell; 
 
     border: 1px solid gray; 
 

 
    } 
 
    .groups { 
 
     border: 1px solid red; 
 
    } 
 

 
    .group-name { 
 
     font-weight: bold; 
 
    } 
 
    
 
    
<div class="details"> 
 
     <div class="groups"> 
 
       <div class="group-name"> 
 
         one 
 
       </div> 
 
       <div class="list"> 
 
       <div class="row"> 
 
         <div class="cell1"> 
 
          cell1 
 
         </div> 
 
         <div class="cell2"> 
 
          cell2 
 
         </div> 
 
         <div class="cell3"> 
 
          cell3 
 
         </div> 
 
        </div> 
 
        <div class="row"> 
 
         <div class="cell1"> 
 
          cell1 
 
         </div> 
 
         <div class="cell2"> 
 
          cell2 
 
         </div> 
 
         <div class="cell3"> 
 
          cell3 
 
         </div> 
 
        </div> 
 
       </div> 
 
     </div> 
 
     <div class="groups"> 
 
       <div class="group-name"> 
 
         two 
 
       </div> 
 
       <div class="list"> 
 
       <div class="row"> 
 
         <div class="cell1"> 
 
          cell1 
 
         </div> 
 
         <div class="cell2"> 
 
          cell2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 
         </div> 
 
         <div class="cell3"> 
 
          cell3 
 
         </div> 
 
        </div> 
 
        <div class="row"> 
 
         <div class="cell1"> 
 
          cell1 
 
         </div> 
 
         <div class="cell2"> 
 
          cell2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 
         </div> 
 
         <div class="cell3"> 
 
          cell3 some big Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 
         </div> 
 
        </div> 
 
       </div> 
 
     </div> 
 
    </div>

答えて

2

同じ大きさのためにフレックスを追加します。

.details { 
 
     display: table; 
 
     width: 100%; 
 
    } 
 
    .row { 
 
     display: table-row; 
 
     display:flex; 
 
    } 
 
    .cell1{ 
 
     width: 30%; 
 
     display: table-cell; 
 
     border: 1px solid gray; 
 
     flex: 1; 
 
    
 
    padding: 1em; 
 

 

 
    } 
 
.cell2 { 
 
     width: 30%; 
 
     display: table-cell; 
 
     border: 1px solid gray; 
 
     flex: 1; 
 
    
 
    padding: 1em; 
 
    
 

 
    } 
 
.cell3 { 
 
     width: 30%; 
 
     display: table-cell; 
 
     border: 1px solid gray; 
 
     flex: 1; 
 
     padding: 1em; 
 

 

 
    } 
 
    .groups { 
 
     border: 1px solid red; 
 
    } 
 

 
    .group-name { 
 
     font-weight: bold; 
 
    }
<div class="details"> 
 
     <div class="groups"> 
 
       <div class="group-name"> 
 
         one 
 
       </div> 
 
       <div class="list"> 
 
       <div class="row"> 
 
         <div class="cell1"> 
 
          cell1 
 
         </div> 
 
         <div class="cell2"> 
 
          cell2 
 
         </div> 
 
         <div class="cell3"> 
 
          cell3 
 
         </div> 
 
        </div> 
 
        <div class="row"> 
 
         <div class="cell1"> 
 
          cell1 
 
         </div> 
 
         <div class="cell2"> 
 
          cell2 
 
         </div> 
 
         <div class="cell3"> 
 
          cell3 
 
         </div> 
 
        </div> 
 
       </div> 
 
     </div> 
 
     <div class="groups"> 
 
       <div class="group-name"> 
 
         two 
 
       </div> 
 
       <div class="list"> 
 
       <div class="row"> 
 
         <div class="cell1"> 
 
          cell1 
 
         </div> 
 
         <div class="cell2"> 
 
          cell2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 
         </div> 
 
         <div class="cell3"> 
 
          cell3 
 
         </div> 
 
        </div> 
 
        <div class="row"> 
 
         <div class="cell1"> 
 
          cell1 
 
         </div> 
 
         <div class="cell2"> 
 
          cell2 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 
         </div> 
 
         <div class="cell3"> 
 
          cell3 some big Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
 
         </div> 
 
        </div> 
 
       </div> 
 
     </div> 
 
    </div>

+0

できればちょうど別の助けが欲しいです。データが存在するかどうかにかかわらず、列の1つを固定したい。今のところそれは歪んでいる。 –

+0

申し訳ありません。私をはっきり説明できますか?列は固定されています。 – Anju

+0

特定の列に対して固定幅が必要でした。私は最小幅と最大幅でそれを達成しました。すべての助けに感謝します。 –

関連する問題