Download presentation
Presentation is loading. Please wait.
Published byVincent Bradford Modified over 8 years ago
1
`
2
Lecture Overview HTML Body Elements Linking techniques HyperText references Linking images Linking to locations on a page Linking to a fragment on another page Linking to mail software Ordering links to a new window Image maps List Table
3
HTML Body Element The element encloses all page contents. Example web page contents: –Text –List –Image –Etc.
4
HTML Body Element - TEXT There are two categories of text element: Block elements –For marking up large blocks of content such as headings and paragraphs Inline elements –For marking up individual words or phrases or to emphasize words in a sentence.
5
HTML Body Element - TEXT Headings There are six different levels of heading: – is the top level heading content, e.g. site or page title is the for the least important heading, e.g. a sub-section This is heading 1
6
HTML Body Element - TEXT Paragraph The element defines a paragraph. When a browser displays a paragraph, it adds a new line before the paragraph. Paragraphs should not be nested inside other paragraphs. The purpose of this page is to demonstrate a basic XHTML document.
7
HTML Body Element - TEXT Inline element Inline elements are used to markup small portions of text. Inline elements must always be nested inside a block level element. The purpose of this page is to demonstrate a basic XHTML document.
8
HTML Body Element - TEXT Styling your text HTML used to feature many ‘physical style’ tags Tags such as can be join with several attributes to specify the colour, typeface and size of text. This is so red
9
HTML Body Element - IMAGE An image can be specified using as shown below. src is use to specify the location of the image width is use to specify the width of the image height is use to specify the height of the image alt is use to specify alternative text in case the image is corrupted. ** Picture should be saved in similar directory with HTML document
10
Linking Techniques Links on a website can be created using an attribute called a HyperText reference (href) which is applied to an anchor element. For example:
11
Linking Techniques Two ways of linking: Text based & Image based. Text based
12
Linking Techniques Image based
13
HyperText References HyperText references provides the path of the link for the browser to follow. –The path can be: Linking to a page within the site Linking to a page outside of the site –The link can be: (X)HTML documents Images Documents Multimedia elements
14
HyperText References Linking to a page within the site. –When linking to a page within your site server, relative URLs are used. –For example if linking to page2.html of your site just use the pathname: Linking to a page outside of the site. –When linking to pages or sites external to your site, server absolute URLs are used –For example, when linking to www.w3c.org include the full protocol and path to the page:
15
HyperText References Some rules when linking to pages within the site: If the (X)HTML page is within the same directory, use: If the (X)HTML page is within a lower directory, use:
16
HyperText References Some rules when linking to pages within the site: If the (X)HTML page is within an even lower directory, use: If the (X)HTML page is within a higher directory, use the Unix pathname convention “../”
17
HyperText References Some rules when linking to pages within the site: If the (X)HTML page is within an even higher directory, use: Do not use backslashes - instead use forward slashes “/” for web programming to separate directory and file components of a path
18
Linking Images Linking images also has several rules: If you are in page2.html as shown in structure below and would like to use picture.gif, use:
19
Linking Images Linking images also has several rules: If you are in page2.html as shown in structure below and would like to use picture.gif:
20
Linking to Locations on A Page Known as linking to a document fragment. Allows you to link to specific points on a page. Clicking on a subject in the contents at the top of the page allows the user to be directed to the desired heading further down the page.
21
Linking to Locations on A Page To do linking to locations on a page, two features are needed: Name the destination using the id attribute Link to the destination using the octothorpe symbol (#) The id attribute The actual headings in the body of the page need to be marked with the id attribute. This uniquely identifies an element within the contents for the browser to find. For example, in the main body of text, Heading 1 would read:
22
Linking to Locations on A Page The octothorpe symbol (#) Each heading is linked to the corresponding text by including the # value in the href attribute. The destination is given a name, in this case “hereisH1” for the first heading:
23
Linking to A Fragment on Another Page Add the fragment name to the end of the page URL in the href link. For example if the headings were all contained within “page4.html”, a page in the same directory, the link would read:
24
Linking to Mail Software mailtoUse the mailto protocol. This allows users to send emails to the specified address from client-side email software. myemail@address.comFor example, linking to an email address myemail@address.com can be write as the following:
25
Opening Links in A New Window Use the target attribute in the anchor element. This will tell the browser in which window the linked content should be displayed For example: This will open all links with this target in a window called “display1”
26
Image Maps An imagemap is a defined region of an image that is given a link. For a client-side imagemap, the browser is required to match the location of the user’s mouse to the coded coordinates of the linked area.
27
Image Maps To produce an imagemap you will need: –An image file within an element –A usemap attribute within the element that defines the map in use –A element that contains the definitions of each of the required elements to be applied to the image
28
Image Maps For example, an image split into 2 coloured regions that link to 2 separate pages: The “usemap” attribute tells the browser to use the “2pages” map with the image.
29
Image Maps Shape Values In this example the shape values chosen are a circle and square. The values are based on the coords.
30
HTML Elements - LIST List of items can be specify using, and. –The tags specify an unordered (bullet pointed) list. –The tags specify an ordered list. –The elements define each item in the list. Triangle Quadrilateral Pentagon Hexagon Triangle Quadrilateral Pentagon Hexagon
31
HTML – Table’s Structure In (X)HTML the structure of the same table is: Tables are constructed from cells Cells contain the content of the table A cell can contain any content, from graphics to multimedia content to even other tables
32
HTML – TABLE – Element Definition is a block level element that always starts on a new line. (X)HTML tables are “row-centric” as there are no column elements. The number of cells in each row determines the number of columns.
33
HTML – TABLE – Element Definition The (X)HTML elements would appear like this: If the elements don’t match up, the browser will not display the table correctly
34
HTML – TABLE – Element Definition Shown left is the (X)HTML source for this table as it would be written within the main body of the page. The convention is to stack the elements to make them easier to locate in the code.
35
HTML – TABLE – Columns & Rows Column spans are generated with the colspan attribute within the or elements. These resize a cell to the right to make it span over the preceding columns. For example:
36
HTML – TABLE – Columns & Rows (X)HTML for merging columns:
37
HTML – TABLE – Columns & Rows Row spans are similar to column spans but merge rows instead. For example:
38
HTML – TABLE – Columns & Rows (X)HTML for merging row:
39
HTML – TABLE – Cell Padding Cell Padding is the amount of space between the cell content and the edge of the cell containing it. The default value for cell padding is 1 pixel
40
HTML – TABLE – Cell Padding The cellpadding attribute can only be applied to the element. This means that all cells within the table are affected by it. The value of cellpadding can be defined. For example: If cell by cell values are required, CSS can be used to fine tune the padding.
41
HTML – TABLE – Cell Spacing Cell Spacing is the amount of space between the cells. The browser default is 2 pixels. To change this value, use the cellspacing attribute in the element:
42
HTML – TABLE – Caption To give the table a brief title or description, use the element. The caption is displayed above the table by default. The caption must be the first thing in the element.
43
HTML – TABLE – Caption
44
References Robbins, J.N. (2007) Learning Web Design – A Beginners Guide to (X)HTML, Style Sheets, and Web Graphics. 2nd edition. Galatea Training Services Ltd.. Singapore
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.