如何使一个跨两列表中的两列?[英]How to make one span both columns in a two column table? 本文翻译自  Ben Ben-Hamo  查看原文  2013-07-12  67174    css/

时间:2022-08-24 21:13:31

如何使一个跨两列表中的两列?[英]How to make one  span both columns in a two column table?
			      
			      
			      
			      
			      
			      
			         本文翻译自
			      
			      
			       Ben Ben-Hamo
			       查看原文
			      
			       2013-07-12
			       67174 
                  
                      
                     
                     
                     
                     css/
                                          
                     
                     
                     html                     
                     
                  
			        
			          
				        
				      
			      
			      
			          
						
						     (adsbygoogle = window.adsbygoogle || []).push({});
 						
                 
                        
                        
                             
How can I create a table like the above example in HTML and CSS. I've tried the following:  
如何在HTML和CSS中创建类似上面示例的表。我尝试过以下方法: 
<table> 
  <tr> 
    <td style="width:50%">TEXT</td>
    <td style="width:50%">TEXT</td> 
  </tr>
  <tr> 
    <td style="width:100%">TEXT</td> 
  </tr>
 
but it won't work. Can anyone help? 
但它不会起作用。有人可以帮忙吗?

     (adsbygoogle = window.adsbygoogle || []).push({});2 个解决方案
                           
                           
							  
							    #1
							    
							      81  
You should use colspan for your second row. Like this : 
您应该使用colspan作为第二行。喜欢这个 : 
<table>
    <tr>
        <td style="width:50%">TEXT</td>
        <td style="width:50%">TEXT</td>
    </tr>
    <tr>
        <td colspan="2" style="width:100%">TEXT</td>
    </tr>
    ...
</table>
 
For learn -> HTML Colspan 
学习 - > HTML Colspan
							     
							                          
                           
							  
							    #2
							    
							      
13  
<td>s have a colspan attribute that determine how many columns it should span over. You example has 2 columns to span, so your cleaned up code would look like this: 
有一个colspan属性,用于确定应跨越多少列。您的示例有2列要跨越,因此清理后的代码如下所示: 
<table>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        
        <td colspan="2">This will have 100% width by default</td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
</table>

							     
							                          
                           
                        
                 
               
				
				     (adsbygoogle = window.adsbygoogle || []).push({});
				
		              ×
		              注意!
		              
		              本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/07/12/3d43b7e1a15dcef8a71365165bf62d61.html。
		              
		              
		            	
		            
		          
		          
			          
				          
					      timeout_show();
					      			
			
			
			  
			   
			   
			   
			       
			           How to make one column table two columns?
			       
			       			       
			   
			       
			           Make an HTML table's column span all the columns
			       
			       			       
			   
			       
			           How to create a DataRelation from one column in a table to two columns in another table
			       
			       			       
			   
			       
			           how to separate one column data into two columns 
			       
			       			       
			   
			       
			           How to add two columns to make a new one
			       
			       			       
			   
			       
			           How to make a table with two fixed columns responsive?
			       
			       			       
			   
			       
			           How do I get a textarea to span two columns of a table
			       
			       			       
			   
			       
			           How to derive a column in a table based on values from one or two other columns
			       
			       			       
			   
			       
			           How to retrieve data from one column refer to another two columns from the same table?
			       
			       			       
			   
			       
			           Make a  span the entire row in a table
			       
			       			       
			   
			   

			   
				
				
				
				  .itdaan_shufu { width:300px;height:600px }
				  @media (max-width: 600px) { .itdaan_shufu { display: none; } }
				
				
				     (adsbygoogle = window.adsbygoogle || []).push({});
				
			
			
		
	
     
    


	
	
	
		粤ICP备14056181号  © 2014-2021 ITdaan.com  
	



  
    ×
    收藏本文
  
  
     添加到收藏夹 *
    
    
     
  
  
    关闭确定
  


 globle_all_pc();

   function buffer(a, b, c) {
	    var d;
	    return function() {
	        if (d) return;
	        d = setTimeout(function() {
	            a.call(this),
	            d = undefined
	        },
	        b)
	    }
	} 

	(function() {
	    function e() {
	        var d = document.body.scrollTop || document.documentElement.scrollTop;
	        d > b ? (a.className = "div1 div2", c && (a.style.top = d - b + "px")) : a.className = "div1"
	    }
	    var a = document.getElementById("float");
	    if (a == undefined) return ! 1;
	    var b = 0,
	    c, d = a;
	    while (d) b += d.offsetTop,
	    d = d.offsetParent;
	    c = window.ActiveXObject && !window.XMLHttpRequest;
	    if (!c || !0) window.onscroll = buffer(e, 50, this)
	})(); 


 
 
 var _hmt = _hmt || [];
 (function() {
   var hm = document.createElement("script");
   hm.src = "https://hm.baidu.com/hm.js?b08728447e2a1a7388d5639bd2a14595";
   var s = document.getElementsByTagName("script")[0];
   s.parentNode.insertBefore(hm, s);
 })();
 
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-143082825-1');

How can I create a table like the above example in HTML and CSS. I've tried the following:

如何在HTML和CSS中创建类似上面示例的表。我尝试过以下方法:

<table> 
  <tr> 
    <td style="width:50%">TEXT</td>
    <td style="width:50%">TEXT</td> 
  </tr>
  <tr> 
    <td style="width:100%">TEXT</td> 
  </tr>

but it won't work. Can anyone help?

但它不会起作用。有人可以帮忙吗?

2 个解决方案

#1


81  

You should use colspan for your second row. Like this :

您应该使用colspan作为第二行。喜欢这个 :

<table>
    <tr>
        <td style="width:50%">TEXT</td>
        <td style="width:50%">TEXT</td>
    </tr>
    <tr>
        <td colspan="2" style="width:100%">TEXT</td>
    </tr>
    ...
</table>

For learn -> HTML Colspan

学习 - > HTML Colspan

#2


13  

<td>s have a colspan attribute that determine how many columns it should span over. You example has 2 columns to span, so your cleaned up code would look like this:

有一个colspan属性,用于确定应跨越多少列。您的示例有2列要跨越,因此清理后的代码如下所示:

<table>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        <!-- The important part is here -->
        <td colspan="2">This will have 100% width by default</td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
</table>

#1


81  

You should use colspan for your second row. Like this :

您应该使用colspan作为第二行。喜欢这个 :

<table>
    <tr>
        <td style="width:50%">TEXT</td>
        <td style="width:50%">TEXT</td>
    </tr>
    <tr>
        <td colspan="2" style="width:100%">TEXT</td>
    </tr>
    ...
</table>

For learn -> HTML Colspan

学习 - > HTML Colspan

#2


13  

<td>s have a colspan attribute that determine how many columns it should span over. You example has 2 columns to span, so your cleaned up code would look like this:

有一个colspan属性,用于确定应跨越多少列。您的示例有2列要跨越,因此清理后的代码如下所示:

<table>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        <!-- The important part is here -->
        <td colspan="2">This will have 100% width by default</td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
    <tr>
        <td width="50%"></td>
        <td width="50%"></td>
    </tr>
</table>