Chapter-1-Introduction to HTML5 and HTML5 Tags
Chapter-1-Introduction to HTML5 and HTML5 Tags
What is HTML?
The first version of HTML was written by Tim Berners-Lee in 1993. Since then, there have
been many different versions of HTML.
60s. Nelson's idea of hypertext was to develop a network of connected text and multimedia
that permitted non-linear information navigation.
2014- HTML 5.0 is released and used worldwide. It is said to be the extended version of
HTML 4.01 which was published in 2012.
HTML TAGS-
<h1> defines the most important heading. <h6> defines the least important heading:
Example-
The <p> tag offers a way to structure your text into different paragraphs which is essential
for creating well-organized and readable web content. Each paragraph of text should go in
between an opening <p> and a closing </p> tag.
Whenever you use the <br /> element, anything following it starts from the next line. This
tag is an example of an empty element, where you do not need opening and closing tags, as
there is nothing to go in between them.The <br /> tag has a space between the
characters br and the forward slash.
<p>
Hello<br />You are on time.<br />
Thanks<br />Mahnaz
</p>
You can use <center> tag to put any content in the center of the page or any table cell.
<center>
<p>This is my first heading</p>
</center>
Horizontal line-
The <hr> tag creates a line from the current position in the document to the right margin and
breaks the line accordingly.
The <hr /> tag is an example of the empty element, where you do not need opening and
closing tags, as there is nothing to go in between them.
<hr />
Preserve Formatting-
Sometimes, you want your text to follow the exact format of how it is written in the HTML
document. In these cases, you can use the preformatted tag <pre>
<pre>
This
Is
A
Pre
Tag
</pre>
The <a> tag defines a hyperlink. The href attribute specifies the URL of the page the link
goes to:
Example-
<a href="https://www.w3schools.com">Visit W3Schools</a>
The src Attribute
The <img> tag is used to embed an image in an HTML page. The src attribute specifies the
path to the image to be displayed:
Example-
<img src="img_girl.jpg">
There are two ways to specify the URL in the src attribute:
Notes: External images might be under copyright. If you do not get permission to use it, you
may be in violation of copyright laws. In addition, you cannot control external images; it can
suddenly be removed or changed.
2. Relative URL - Links to an image that is hosted within the website. Here, the URL does
not include the domain name. If the URL begins without a slash, it will be relative to the
current page. Example: src="img_girl.jpg". If the URL begins with a slash, it will be relative
to the domain. Example: src="/images/img_girl.jpg".
The <img> tag should also contain the width and height attributes, which specify the width
and height of the image (in pixels):
Example
<img src="img_girl.jpg" width="500" height="600">
The alt Attribute
The required alt attribute for the <img> tag specifies an alternate text for an image, if the
image for some reason cannot be displayed. This can be due to a slow connection, or an error
in the src attribute, or if the user uses a screen reader.
Example-
<img src="img_girl.jpg" alt="Girl with a jacket">
HTML Formatting Elements
You can add comments to your HTML source by using the following syntax:
HTML Images-
syntax-
Example-
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
An HTML table consists of one <table> element and one or more <tr>, <th>,
and <td> elements.
The <tr> element defines a table row, the <th> element defines a table header, and the <td>
element defines a table cell.
The HTML <table> cellspacing Attribute is used to specify the space between the cells.
The cellspacing attribute is set in terms of pixels. If the cellspacing attribute is not explicitly
set, most browsers will apply a default spacing of 1 pixel.
Syntax-
<table cellspacing="pixels">
<td colspan="number">
<th colspan="number">
Cell padding is the space between the cell edges and the cell content.By default the padding
is set to 0.
th, td {
padding: 15px;
}
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.
The list items will be marked with bullets (small black circles) by default:
Example-
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Ordered HTML List
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
Example-
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Nested HTML Lists
Example-
<ol>
<li>Coffee</li>
<li>Tea
<ol>
<li>Black tea</li>
<li>Green tea</li>
</ol>
</li>
<li>Milk</li>
</ol>
What is the HTML <marquee> Tag?
The <marquee> tag is used to create a scrolling effect for text or images. This tag can make
content move left, right, up, or down, adding an interactive element to your web page.
Basic Syntax
<marquee>
<!-- contents -->
</marquee>
Blink tag-
The HTML <blink> tag was used to create blinking text that flashes slowly.
Example-
<blink> Here is your text that has to blink. </blink>
Div Tag-
The <div> tag is used as a container for HTML elements - which is then styled with CSS or
manipulated with JavaScript.
Note: By default, browsers always place a line break before and after the <div> element.
Example-
<div class="myDiv">
<h2>This is a heading in a div element</h2>
<p>This is some text in a div element.</p>
</div>
<Frame> Tag-
HTML <frame> tag define the particular area within an HTML file where another HTML web
page can be displayed.
A <frame> tag is used with <frameset>, and it divides a webpage into multiple sections or
frames, and each frame can contain different web pages.
Syntax-
< frame src = "URL" >
<frameset> Tag-
The HTML <frameset> tag defines a set of frames within a web page. It specifies the layout
of multiple frames, each containing separate HTML documents, enabling the creation of
multi-pane layouts for displaying content.
Syntax-
<frameset cols = "pixels|%|*">