Understanding Column Span and Row Span

These 2 features allows you to expend your row  and columns across multiple other columns and rows when they would usually be forced to stop. In this tutorial we will learn how to use these attributes.

Why we need this:

Normally when we create a cell, the cell can not pass over into the space bellow or above another cell. For instance look at the example bellow. The cell in the bottom row can not move past the length of that on the top row without extending the both cells.
 
As you can see the row e is not able to reach the cell 3. Using the column span attribute we can solve this problem and make it more organize.

 The attribute for column span is < TD COLSPAN="X">

"X" is the number of columns you want to extend the span. For example, You have a table of 3 column and you want to extend it upto 2 column, so how you will do it? Just put 2 instead of "X". Here is the example :

Now see another example where we can extend the span upto 3 column
I will add the codes at the end of the tutorial 

Row Span

In row span it extends the cells on vertical row (up and down). The attribute for this one is
<TD ROWSPAN="X">  Same is column span the "X" is the number of cells you want to extend vertically.

 <TD ROWSPAN="2">  applied here. So we extended the cell for 2 rows vertically. Now lets see for 3 rows
We just use 3 instead of X. You can use as many span as you want. The codes are bellow for both column and Row span. .

Column Span:

<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title>Column Span</title>
</head>
<body>

<TABLE BORDER="1">
  <tr>
    <th>Months</th>
    <th>year</th>
    <th>Salary</th>

  </tr>
  <tr>
    <td>January</td>
    <td>2016</td>
    <td>$800</td>
  </tr>
   <tr>
    <td>February</td>
    <td>2016</td>
    <td>$800</td>
  </tr>
  <tr>
    <td colspan="3">Total=$1600</td>

</TABLE>

</body>
</html>

Row Span 

<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title>Row Span</title>
</head>
<body>


<TABLE BORDER="1">
  <tr>
    <th>Months</th>
    <th>year</th>
    <th>Salary</th>
    <th rowspan="3">Total=$1600</th>

  </tr>
  <tr>
    <td>January</td>
    <td>2016</td>
    <td>$800</td>
  </tr>
   <tr>
    <td>February</td>
    <td>2016</td>
    <td>$800</td>
  </tr>
  <tr>

</TABLE>

</body>
</html>

I hope this will help you to understand, practice it and if you found any problem let me know in comment or in our facebook page. Feel free to share if it helped you. Best of Luck

MARGIN ATTRIBUTE

Like any other document we can select TOP, BOTTOM, LEFT, RIGHT Margin for HTML document

Here is an example 

<HTML>
<HEAD>
<TITLE> Example of Margin Attribute </TITLE>
</HEAD>
<Body background=bg.jpg LEFTMARGIN="100" RIGHTMARGIN="60">
<H1>This is Tanjies </H1>
<P><Strong>Services we are providing</strong></p>
<OL>
<Li>Web Development
<Li>Search Engine Optimization
<Li>Web Application
<Li>Social Media Marketing
</OL>
<P><Strong>Themes We are Using </strong></p>
<OL>
<Li>The 7
<Li>Avada
<Li>Jollyall
<Li>Udesign
</OL>
<Body>
</HTML>

The saving procedure is like before, but if u face something wrong then don't forget to write me. 



BACKGROUND ELEMENT

With this element we can change the background with image. For this we can use JPG, PNG, GIF,JPEG image. In the beginning we have said we need to keep HTML files in a folder. If you didnt do that yet, now its time to do that. To use the image as background we must need to keep those where are the HTML files. We cam make a folder name "test" and keep html files there and also save those images insider "test" folder. We can also create a folder inside test folder and name it Image and keep image files there. Lets try.

The format is <Body Background=filename.jpg>

 Here is the Example

 
<HTML>
<Head>
<Title> Example of Background Image</Title>
</Head>
<Body background=bg.jpg>
<H1>This is Tanjies </H1>
<P><Strong>Services we are providing</strong></p>
<OL>
<Li>Web Development
<Li>Search Engine Optimization
<Li>Web Application
<Li>Social Media Marketing
</OL>
<P><Strong>Themes We are Using </strong></p>
<OL>
<Li>The 7
<Li>Avada
<Li>Jollyall
<Li>Udesign
</OL>
<Body>
</HTML>

The saving procedure is like before, but if u face something wrong then don't forget to write me. 

 

BGCOLOR ELEMENT(Background Color)

We didnt add any background color yet. Now we will add background color. We have to put it as attribute under the <BODY> tag. For color we can directly add RED, GREEN, BLUE, WHITE or we can use the HEX CODE. 

Program 

<HTML>
<HEAD>
<TITLE> Example of BG COLOR ELEMENT</TITLE>
<HEAD>
<BODY BGCOLOR=RED>
<H1>TANJIES DESIGN </H1>
<LI>Web Designing</LI>
<LI>Search Engine Optimization</LI>
<LI>Web Application</LI>
</BODY>
</HTML>

Example 2

<HTML>
<HEAD>
<TITLE> Example of BG COLOR ELEMENT</TITLE>
<HEAD>
<BODY BGCOLOR=#FF0000>
<H1>TANJIES DESIGN </H1>
<LI>Web Designing</LI>
<LI>Search Engine Optimization</LI>
<LI>Web Application</LI>
</BODY>
</HTML>

For Hex code you can check our old post, HEX CODE

The saving procedure is like before, but if u face something wrong then don't forget to write me.