Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 3: Hyperlinks and Images.

Similar presentations


Presentation on theme: "Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 3: Hyperlinks and Images."— Presentation transcript:

1 Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 3: Hyperlinks and Images

2 The A Element (Basics) Use the anchor element to define hyperlinks A hyperlink is a reference to an external document such as another HTML page, image, movie, etc. The content of the anchor element must be phrasing content You cannot have a P element inside an A element because P is flow content You can have an IMG element (covered later) inside an A element because an image is phrasing content

3 The A Element (Syntax) Description Used to define a hyperlink (hypertext anchor). Comments Start Tag: REQUIRED End Tag: REQUIRED Self-Closing Tag: FORBIDDEN Example Yahoo!

4 The A Element (Attributes) Optional Attributes HREF: Specify the destination anchor TARGET: Specify where (in what browser window) to open the hyperlink document TITLE: Specify a tool tip when the mouse hovers over the anchor text

5 Linking to Specific Locations In your destination document, define a location to link to using the ID attribute Example: This is a paragraph with an ID. In your source document, define a hyperlink to the destination document, appending an #id to the URL Example: Security Link

6 Absolute URLs Full URL, including protocol, hostname, path and filename (optional) image

7 Relative URLs A URL that is relative to a base URL./ = base URL directory../ = parent directory / = replaces everything from path onwards // = replaces everything from hostname onwards

8 Images A rectangular array of pixels Bitmaps (Map of bits) Pixmaps (Map of pixels) Images tend to be quite large so compressed formats are quite common, especially on the web Some compression techniques include Color reduction Frequency analysis

9 Web-Friendly Images Joint Photographic Experts Group (JPEG) JPG, JPEG, JP2 extensions Variable loss format Graphic Interchange Format (GIF) GIF extension Lossless format Portable Network Graphic (PNG) PNG extension Lossless format

10 The IMG Element (Basics) The IMG element can be used anywhere flow, phrasing and embedded content are expected For example: Within BODY and LI elements (flow content) Within P, B, and I elements (phrasing content) Basically, you can put images almost anywhere

11 The IMG Element (Syntax) Description Marks embedded image content. Comments Start Tag: REQUIRED End Tag: FORBIDDEN Self-Closing Tag: YES (XML syntax) Example

12 The IMG Element (Attributes) Required Attributes SRC: URL to specify location of image ALT: Alternative text (called fallback content) Non-required Attributes USEMAP: Associates an IMG with a MAP TITLE: Associates an IMG with a tool tip

13 Images and Hyperlinks The IMG element is phrasing content, and can therefore be a child of the A element Example:

14 The MAP Element (Basics) The MAP element can be defined anywhere flow and phrasing content is expected (in BODY, P, etc.) The MAP element defines an image map An image map is a set of clickable regions (areas) on an image that can be associated with hyperlinks Every MAP must contain zero or more AREA elements

15 The MAP Element (Syntax) Description Used to define an image map. Comments Start Tag: REQUIRED End Tag: REQUIRED Self-Closing Tag: FORBIDDEN Example

16 The MAP Element (Attributes) Required Attributes NAME: Associates a MAP element with a named identifier. This named identifier is used by the IMG element to associate it with a particular map. Names are referenced by IMG using hash-name references (# sign followed by the named identifier) Example:

17 The AREA Element (Basics) The AREA element specifies a region of an image that is associated with some text, a hyperlink, or a dead area Text: ALT (fallback) text Hyperlink: AREA has a hyperlink (HREF) attribute Dead Area: AREA with no HREF or ALT text

18 The AREA Element (Syntax) Description Marks a clickable region of an image map. Comments Start Tag: REQUIRED End Tag: FORBIDDEN Self-Closing Tag: YES (XML Syntax) Example

19 The AREA Element (Attributes) Optional Attributes HREF: Specify a hyperlink to go to when an area is clicked on ALT: Alternative (fallback) text SHAPE: Shape of area (circ, default, poly, or rect) COORDS: List of image coordinates TITLE: Tool tip displayed when mouse hovers over area

20 Associating Maps to Images We need to associate an image with a map Give the MAP a NAME attribute Use the USEMAP attribute of the IMG element Reference the name using a Hash Name Reference Example


Download ppt "Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 3: Hyperlinks and Images."

Similar presentations


Ads by Google