📜  什么是 Bootstrap 中的压缩表?

📅  最后修改于: 2021-11-07 08:27:09             🧑  作者: Mango

.table-condensed 是 Bootstrap 3 框架中的一个类。当我们想要行填充一半时可以使用它,以便我们可以压缩表格。这样我就可以更人性化了。因此,当您想在网页上显示更密集的表格时,使用 .table-condensed 类。如果我们不在引导表中使用 .table-condensed 类,那么当您有一个密集的表并尝试在小屏幕设备上查看它时,我们需要水平滚动以查看隐藏的列,而当 .table-condensed 类是使用整个表格根据您的屏幕尺寸进行压缩,以便您可以立即获得表格的完整视图。

句法:

  • 对于 Bootstrap 3

  • 对于 Bootstrap 4

  • 示例 1:在此示例中,我们将使用表压缩类在 Bootstrap 3 中创建一个压缩表。

    HTML
    
    
      
    
        Bootstrap Condensed Table
        
      
        
        
        
        
    
      
    
      
        
        
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
    IDFirst NameLast NameEmail
    1IronManironman@mail.com
    2CaptainAmericacaptainamerica@mail.com
    3DoctorStrangedoctorstrange@mail.com
    4BlackWidowblackwidow@mail.com
      


    HTML
    
    
      
    
        Bootstrap Condensed Table
        
      
        
        
        
        
    
      
    
        
        
            
                
                    
                    
                    
                    
                
            
            
                
                    
                    
                    
                    
                
                
                    
                    
                    
                    
                
                
                    
                    
                    
                    
                
                
                    
                    
                    
                    
                
            
        
    IDFirst NameLast NameEmail
    1IronManironman@mail.com
    2CaptainAmericacaptainamerica@mail.com
    3DoctorStrangedoctorstrange@mail.com
    4BlackWidowblackwidow@mail.com
      


输出:

示例 2:在本示例中,我们将使用 table-sm 类在 Bootstrap 4 中创建一个压缩表。

HTML



  

    Bootstrap Condensed Table
    
  
    
    
    
    

  

    
    
        
            
                
                
                
                
            
        
        
            
                
                
                
                
            
            
                
                
                
                
            
            
                
                
                
                
            
            
                
                
                
                
            
        
    
IDFirst NameLast NameEmail
1IronManironman@mail.com
2CaptainAmericacaptainamerica@mail.com
3DoctorStrangedoctorstrange@mail.com
4BlackWidowblackwidow@mail.com
  

输出: