tag syntax and attributes like href and target for linking to resources. It explains how to create bookmarks, use images as links, and incorporate audio and video elements in web pages. Additionally, it distinguishes between absolute and relative URLs for linking to web pages and resources."> tag syntax and attributes like href and target for linking to resources. It explains how to create bookmarks, use images as links, and incorporate audio and video elements in web pages. Additionally, it distinguishes between absolute and relative URLs for linking to web pages and resources.">
Chapter 6 Notes
Chapter 6 Notes
Anchor: An element in a webpage that creates a hyperlink between a source anchor and
a destination anchor. These can be used to link 2 resources together
Links are found in nearly all web pages. Links allow users to click their way from page to
page.When we move the mouse over a link, the mouse arrow will turn into a little hand.
The HTML <a> tag defines a hyperlink. It has the following syntax: <a href="url">link
text</a>The most important attribute of the <a> element is the href attribute, which indicates the
link's destination.
The link text is the part that will be visible to the reader.Clicking on the link text, will send
the reader to the specified URL address.By default, links will appear as follows in all
browsers:
• An unvisited link is underlined and blue
• A visited link is underlined and purple
• An active link is underlined and red
<style>
a:link { color: green; background-color: transparent; text-decoration: none;}
a:visited {color: pink; background-color: transparent; text-decoration: none;}
a:hover {color: red; background-color: transparent; text-decoration: underline;}
a:active { color: yellow; background-color: transparent; text-decoration: underline;}
</style>
MP3 audio/mpeg
OGG audio/ogg
WAV audio/wav
HTML Video
The HTML <video> element is used to show a video on a web page.
The HTML <video> Element
To show a video in HTML, use the <video> element:
<video width="320" height="240" controls src="movie.mp4" type="video/mp4">The
browser does not support the video tag.</video>
To start a video automatically, use the autoplay attribute and add muted after autoplay to let
the video start playing automatically
HTML Video - Media Types
MP4 video/mp4
WebM video/webm
Ogg video/ogg
FRAMES
The iframe in HTML stands for Inline Frame. The ” iframe ” tag defines a rectangular
region within the document in which the browser can display a separate document, including
scrollbars and borders. An inline frame is used to embed another document within the current
HTML document. The ‘ src ‘ attribute is used to specify the URL of the document that
occupies the iframe.
Syntax:
<iframe src="URL" title="description"></iframe>
Attributes value: It contains a single value URL that specifies the URL of the document that
is embedded in the iframe. There are two types of URL links which are listed below:
• Absolute URL: It points to another webpage.
• Relative URL: It points to other files of the same web page.
Absolute URLs and Relative URLs
Use a full URL to link to a web page:
<a href="https://www.w3schools.com/html/default.asp">HTML tutorial</a>
Link to a page located in the html folder on the current web site:
<a href="/html/default.asp">HTML tutorial</a>
Link to a page located in the same folder as the current page:
<a href="default.asp">HTML tutorial</a>
The main difference between an absolute URL and a relative URL is this. A relative URL
points to a file relative to the current directory or file, whereas an absolute URL is a complete
address that leads to a file or resource. Since a relative URL is shorter and more portable than
an absolute URL, which includes more information, it is simpler to utilize. But only links
hosted on the same server as the page from which they are referred are allowed to use relative
URLs.