The Href Attribute: Example
The Href Attribute: Example
You will learn more about links in our HTML Links chapter.
ADVERTISEMENT
The href attribute of <a> specifies the URL of the page the link
goes to
HTML Table
HTML tables allow web developers to arrange data into rows and
columns.
Table Cells
Each table cell is defined by a <td> and a </td> tag.
td stands for table data.
Everything between <td> and </td> are the content of the table cell.
Example
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
</table>
Try it Yourself »
Note: A table cell can contain all sorts of HTML elements: text, images, lists,
links, other tables, etc.
ADVERTISEMENT
Table Rows
Each table row starts with a <tr> and ends with a </tr> tag.
tr stands for table row.
Example
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
Try it Yourself »
You can have as many rows as you like in a table; just make sure that the
number of cells are the same in each row.
Note: There are times when a row can have less or more cells than another.
You will learn about that in a later chapter.
Table Headers
Sometimes you want your cells to be table header cells. In those cases
use the <th> tag instead of the <td> tag:
th stands for table header.
Example
Let the first row be table header cells:
<table>
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
Try it Yourself »
By default, the text in <th> elements are bold and centered, but you can
change that with CSS.
HTML Paragraphs
A paragraph always starts on a new line, and is usually a block of text.
HTML Paragraphs
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Display
Large or small screens, and resized windows will create different results.
With HTML, you cannot change the display by adding extra spaces or extra
lines in your HTML code.
The browser will automatically remove any extra spaces and lines when the
page is displayed:
Example
<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>
<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>
The <hr> tag defines a thematic break in an HTML page, and is most often
displayed as a horizontal rule.
Example
<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>
Try it Yourself »
The <hr> tag is an empty tag, which means that it has no end tag.
Use <br> if you want a line break (a new line) without starting a new
paragraph:
Example
Try it Yourself »
The <br> tag is an empty tag, which means that it has no end tag.
Example
<p>
My Bonnie lies over the ocean.
Try it Yourself »
Solution - The HTML <pre> Element
Example
<pre>
My Bonnie lies over the ocean.
Try it Yourself »
Exercise?
True
False
Submit Answer »
Tag Description
<p> Defines a paragraph
HTML Links
The target attribute can have one of the following values: