HTML – Tables

Hits: 4

HTML – Tables

 

Tables can be difficult at first, but with a little patience and practice you will see that things are not always how they seem to be. The <table> tag is used to open a table. Within this tag we will find two others typical tags, <tr> (the table lines) and <td> (the table column). But the best explanation is always an example:

HTML Code:

<table border="1">
	<tr>
		<td>Row 1 Cell 1</td>
		<td>Row 1 Cell 2</td>
	</tr>
	<tr>
		<td>Row 2 Cell 1</td>
		<td>Row 2 Cell 2</td>
	</tr>
</table>

Demo

Row 1 Cell 1 Row 1 Cell 2
Row 2 Cell 1 Row 2 Cell 2

The content will be placed within the table’s rows. A row represents what is between <td> and </td>. The border attribute establishes the length of the table’s edge.

HTML – Asymmetrical tables

To form asymmetrical tables we will use ‘rowspan’ to cross more than one line and ‘colspan’ to cross more than one columns. Also, if we want that the first line to serve as titles line for all the columns we will use the <th> tag. These will be written with bold letters as we will see in the following example:

HTML Code:

<table border="1"> 
	<tr>
		<th>Column 1</th> 
		<th>Column 2</th>
		<th>Column 3</th>
	</tr>
	<tr>
		<td rowspan="2">Row 1 Cell 1</td> 
		<td>Row 1 Cell 2</td>
		<td>Row 1 Cell 3</td>
	</tr>
	<tr>
		<td>Row 2 Cell 2</td>
		<td>Row 2 Cell 3</td>
	</tr> 
	<tr>
		<td colspan="3">Row 3 Cell 1</td>
	</tr>
</table>

Demo

Column 1 Column 2 Column 3
Row 1 Cell 1 Row 1 Cell 2 Row 1 Cell 3
Row 2 Cell 2 Row 2 Cell 3
Row 3 Cell 1

HTML – Spacing the cells

With the help of the ‘cellpadding’ and ‘cellspacing’ attributes we will establish the distance between the cells. ‘Cellspacing’ establishes the size of the edge, and ‘cellpadding’ the distance between the edge and the content. In the following example a little bit of color has also been added.

HTML Code:

<table border="1" cellspacing="10" bgcolor="rgb(0,255,0)"> 
	<tr> 
		<th>Column 1</th>
		<th>Column 2</th> 
	</tr> 
	<tr>
		<td>Row 1 Cell 1</td>
		<td>Row 1 Cell 2</td>
	</tr>
	<tr>
		<td>Row 2 Cell 1</td>
		<td>Row 2 Cell 2</td>
	</tr> 
</table>

 

To better make the difference you can erase the edge from the previous example.

The distance between the cells and the edge’s size will be interpreted in pixels by the browser. Using this ‘law’ a value of 10 means actually 10 pixels. This attribute is not the only one that uses as unit of measure the pixels, but we will learn about the others as we progress through the next tutorials.

 

Python Example for Beginners

Two Machine Learning Fields

There are two sides to machine learning:

  • Practical Machine Learning:This is about querying databases, cleaning data, writing scripts to transform data and gluing algorithm and libraries together and writing custom code to squeeze reliable answers from data to satisfy difficult and ill defined questions. It’s the mess of reality.
  • Theoretical Machine Learning: This is about math and abstraction and idealized scenarios and limits and beauty and informing what is possible. It is a whole lot neater and cleaner and removed from the mess of reality.

Data Science Resources: Data Science Recipes and Applied Machine Learning Recipes

Introduction to Applied Machine Learning & Data Science for Beginners, Business Analysts, Students, Researchers and Freelancers with Python & R Codes @ Western Australian Center for Applied Machine Learning & Data Science (WACAMLDS) !!!

Latest end-to-end Learn by Coding Recipes in Project-Based Learning:

Applied Statistics with R for Beginners and Business Professionals

Data Science and Machine Learning Projects in Python: Tabular Data Analytics

Data Science and Machine Learning Projects in R: Tabular Data Analytics

Python Machine Learning & Data Science Recipes: Learn by Coding

R Machine Learning & Data Science Recipes: Learn by Coding

Comparing Different Machine Learning Algorithms in Python for Classification (FREE)

Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.  

Google –> SETScholars