About rowspan

Asked

Viewed 875 times

2

<p align="center">
            <table border="1" cellspacing="0" cellpadding"2">

            <tr><td colspan="2">Tabela de Caracteristicas</td></tr>

            <tr> **<td>rowspan="4"</td>** <td>Philips</td> <td align="center">Altura</td> <td>115,5 mm</td> 



        <!-- o rowspan não esta querendo funcionar aqui na td -->

        </tr>
        <tr> <td align="center">Largura</td> <td>90,45 mm</td></tr>
        <tr> <td align="center">Profundidade</td><td>5 cm</td></tr>
        <tr> <td align="center">Peso</td><td>400 gr</td> </tr>

        </table>    
    </p>    

I do not know what is missing here so that the table and its dimensions can open a space to the left of 4 lines to stand like an empty cube with the word Philips, this taking the place of four lines.

I need some help. Thank you in advance, who can help me.

<p align="center">
			<table border="1" cellspacing="0" cellpadding"2">
			
			<tr><td colspan="2">Tabela de Caracteristicas</td></tr>
			
			<tr> <td>rowspan=""</td> <td>Philips</td> <td align="center">Altura</td> <td>115,5 mm</td> 
			
			<!-- o rowspan não esta querendo funcionar aqui na td -->
			
			</tr>
			<tr> <td align="center">Largura</td> <td>90,45 mm</td></tr>
			<tr> <td align="center">Profundidade</td><td>5 cm</td></tr>
			<tr> <td align="center">Peso</td><td>400 gr</td> </tr>
			
			</table>	
		</p>	

  • Put the code to make it easier for someone to help you.

2 answers

2

They serve to indicate that a certain td will expand by a specific number of rows ("rowspan") or columns ("colspan") beyond the space it would already occupy in the table.

For example, "colspan=3" will cause the td occupy two more (1+2) the space of two more td to the right of it:

<table border='1'>
    <tr>
        <td>a</td><td>b</td><td>c</td><td>d</td>
    </tr>
    <tr>
        <td colspan=3>e</td>
        <td>f</td>
    </tr>
    <tr>
        <td>g</td><td>h</td><td>i</td><td>j</td>
    </tr>
</table>

Just as "rowspan=3" will take up the space of three (1+2) td beneath him:

<table border='1'>
    <tr>
        <td rowspan=3>a</td>
        <td>b</td><td>c</td><td>d</td>
    </tr>
    <tr>
        <td>e</td><td>f</td><td>g</td>
    </tr>
    <tr>
        <td>g</td><td>h</td><td>i</td>
    </tr>
</table>

They can still be used together to occupy both the space on the right and the below:

<table border='1'>
    <tr>
        <td>a</td><td>b</td><td>c</td><td>d</td>
    </tr>
    <tr>
        <td>e</td>
        <td colspan=2 rowspan=2>f</td>
        <td>g</td>
    </tr>
    <tr>
        <td>g</td>
        <td>h</td>
    </tr>
</table>

That is, they are analogous to the commands to merge cells in spreadsheets and word processors.

  • Thank you! I understood. But specifically for this code, by testing it, the table and the information when run are out, leasing. So in this, specific case is where I’m not understanding, what I did wrong, when it came to implementing the code, why is the information out of allocation.

  • Remember that you need to discount the td that you stretched from the neighboring rows and columns. If you have three columns and did "colspan=2" this table row should only have two td.

  • I’m grateful! God bless you.

1

Try:

<p align="center">
<table border="1" cellspacing="0" cellpadding"2">
  <th colspan=3>Tabela de Caracteristicas</th>

  <tr>  
    <td rowspan=4>Philips</td>
    <td align="center">Altura</td>
    <td>115,5 mm</td> 
  </tr> 

  <tr>
    <td align="center">Largura</td>
    <td>90,45 mm</td> 
  </tr> 

  <tr> 
    <td align="center">Profundidade</td>
    <td>5 cm</td>
  </tr> 

  <tr>
    <td align="center">Peso</td>
    <td>400 gr</td>
  </tr> 
</table>    
</p>    
  • Perfect!!!! Grateful! It was on top of the spot. Now yes.

  • I identified my mistake. I had to put a align for each td.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.