HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 6. USING EXTERNAL RESOURCES 69


These external resources are identified byURL: Uniform Resource Locator.


6.12.1 img src=


“img” stands for image. The HTMLimg tagprovides a way to retrieve
an image for display in the current webpage. The src attribute specifies the
URL where the image can be found.


6.12.2 a href=


In theatag, a stands for anchor. The HTMLa tagprovides a link to another
webpage. By clicking on the link, the user causes the other webpage to be
loaded. The typical usage of thea tagis as follows:


bbb


The aaa part is a URL that identifies the page to be loaded next.


The bbb part is text (or an image, or both) that is clickable to cause that
page load.



In this version, ccc is the URL of the image to be displayed.


Fragment ID


At the tail end of a URL, an ID can be specified. This is also called a
fragment id.


It is introduced by a hashtag, and requests the browser to (a) load the
page specified, and (b) position the page so that the requested ID is visible,
usually at the top of the browser’s viewing area.


yyy


This creates a clickable link that displays the word yyy. When clicked, the
webpage xxx is loaded, and within that webpage, the ID abc is sought. If
found, it will become the focus of the webpage.


yadda


This creates a target within the webpage. The target happens to be an h1
tag. It has an ID of abc and displayed content of yadda. By specifying an

Free download pdf