Futm-cpt112 - HTML 1
Futm-cpt112 - HTML 1
<head>
Horizontal Lines
Horizontal lines are used to visually break-up sections of a document.
The <hr> tag creates a line from the current position in the document to
the right margin and breaks the line accordingly. For example, you may
want to give a line between two paragraphs as in the given example
below:
<!DOCTYPE html>
<html>
<head> <title>Horizontal Line Example</title> </head>
<body>
<p>This is paragraph one and should be on top</p>
<hr />
<p>This is paragraph two and should be at bottom</p>
</body>
Nonbreaking Spaces
In cases, where you do not want the client browser to break text, you
should use a nonbreaking space entity instead of a normal space.
For example, when coding the "12 Angry Men" in a paragraph, you should
use something similar to the following code:
<!DOCTYPE html>
<html>
<head> <title>Nonbreaking Spaces Example</title> </head>
<body>
<p>An example of this technique appears in the movie
"12 Angry Men."</p>
</body>
</html>
HTML Links
HTML links are defined with the <a> tag: <a href="url">link
text</a>. The link's destination is specified in the href
attribute. Attributes are used to provide additional
information about HTML elements. Example:
<a href="https://www.w3schools.com/html/">Visit
our HTML tutorial</a>
HTML image
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and
height are provided as attributes. Example:
<img src="smiley.gif" alt="Smiley face"
height="42" width="42">
HTML Lists
HTML lists are defined with the <ul> (unordered/bullet list) or the
<ol> (ordered/numbered list) tag, followed by <li> tags (list items):
Example: unordered/bullet list
<!DOCTYPE html>
<html>
<head> <title>HTML list Tag</title> </head>
<body>
<p >Following is a list of fruits</p>
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
</body>
</html>
HTML Lists cont…
Example: ordered/numbered list
<!DOCTYPE html>
<html>
<head> <title>HTML list Tag</title> </head>
<body>
<p>Following is a list of vegetables</p>
<ol>
<li>Beetroot</li>
<li>Radish</li>
</ol>
</body>
</html>
HTML Comments
Comment is a piece of code which is ignored by any web
browser. It is a good practice to add comments into your
HTML code, especially in complex documents, to indicate
sections of a document, and any other notes to anyone
looking at the code. Comments help you and others
understand your code and increases code readability.
HTML comments are placed in between <!-- ... -->
tags. So, any content placed with-in <!-- ... --> tags will
be treated as comment and will be completely ignored by
the browser. In HTML there are three types of comments
those are described as follows:
HTML Comments cont…
Single comment
<!DOCTYPE html>
<html>
<head> <!-- Document Header Starts --> <title>This is
document title</title>
</head> <!-- Document Header Ends -->
<body>
<p>Document content goes here.....</p>
</body>
</html>
HTML Comments cont…
Multiline Comments
You can comment multiple lines by the special beginning tag <!--
and ending tag --> placed before the first line and end of the last
line as shown in the given example below. Example
<!DOCTYPE html>
<html>
<head> <title>Multiline Comments</title> </head>
<body>
<!--
This is a multiline comment and it can
span through as many as lines you like.
-->
<p>Document content goes here.....</p>
</body> </html>
HTML Tables
HTML Tables is used to preset data in rows and columns
format. A Table is the collection of rows and rows is the
collection of columns.
<tr> stands for table rows. To add a row in a table
<table row> tags are used. <td> or <th> is used to
put the column inside the row. Whereas <td> means
table data and <th> means table head. Syntax:
<table>
<tr>
<td>row1col1</td>
<td>row1col2</td>
</tr>
</table>
HTML Tables cont…
Example
<table border="1">
<tr>
<th>Name</th>
<th>Email</th>
</tr>
<tr>
<td>phptpoint</td>
<td>[email protected]</td>
</tr>
<tr>
<td>phptpoint blog</td>
<td>[email protected]</td>
</tr>
</table>
How to merge table column
you want to merge 2 or more than 2 column (cell), use colspan
property of <td colspan="2″> or <th colspan=”2″>. Example
<table border="1">
<tr>
<th colspan="2"> User Details</th>
</tr>
<tr>
<th>Name</th>
<th>Email</th>
</tr>
<tr>
<td>phptpoint</td>
<td>[email protected]</td>
</tr>
<tr>
<td>phptpoint blog</td>
<td>[email protected]</td>
</tr> </table>
How to merge table rows
To merge table rows in HTML, you can use the `rowspan` attribute. Here's a
simple example:
<<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td rowspan="2">John</td>
<td>25</td>
</tr>
<tr>
<td>30</td>
</tr>
</table>
Nested Table
Nested table means how to use table inside a table. When you want to use a table inside
a table write the syntax of table in between your cell i.e either <td> or <th>. Example
<html>
<body>
<table border="1" bgcolor="gray" width="200" height="200">
<tr>
<th>
<table align="center" border="1" bgcolor="#F8F8F8" width="100" height="100">
<tr>
<th>Inner Table</th>
</tr>
</table>
</th>
</tr>
</table>
</body>
</html>