Download presentation
Presentation is loading. Please wait.
Published byCharles Hensley Modified over 8 years ago
1
XHTML HyperText Markup Language Instructs a browser how to “render”/display/format text
2
XHTML Syntax The basic building block is the “element” An element is composed of a “start tag”, some text (content) and an “end tag” E.g. hello world Start tag End tag content
3
Start Tag “<“ Name of the tag 0 or more “attributes” “>” E.g. – name attributes
4
Content May be plain text May include other elements E.g. – Hello world – She wore a very large hat
5
Attributes Name/value pairs Syntax: name=“value” E.g. – class=“defn” – id=“abc”
6
End tag “</” Name of the corresponding start tag “>” E.g. –
7
XHTML vs. HTML XML stands for eXtensible Markup Language XML is a family of similar languages XHTML is a reformulation of HTML in XML syntax XHTML is the preferred language for new Web documents
8
Case sensitivity XHTML is case sensitive; tag and attribute names must be given in lower case E.g. – not
9
End tags In XHTML, end tags are required Applies particularly to and tags E.g. – … … not … … …
10
Empty elements Empty elements must use the XML convention for empty elements E.g. not
11
Attribute values Attribute values must be quoted E.g. – not
12
Html element Every document consists of a single html element: [link]greendreams.htmllink Green Dreams Green dreams sleep peacefully.
13
element only inside a element “name” attribute specifies a property name “content” attribute specifies a property value typical properties: author, keywords, description
14
Spacing Adjacent spaces, tabs, newlines in the input reduce to a single space in the output linkspacing.htmllink The following will not display what you expect: ProvinceSales Tax Rate Ontario8% Alberta0% British Columbia7%
15
Paragraphs The spacing rules apply to newlines between paragraphs: linkbad_para.htmlink This is paragraph 1. It was a quiet day for all the quitters. Now is the time for all the good men to go to aid of the party.The quick brown fox jumps over the lazy dog. This is paragraph 2. It was a quiet day for all the quitters. Now is the time for all the good men to go to aid of the party.The quick brown fox jumps over the lazy dog.
16
element Enclose logical paragraphs inside a … element linkgood_para.htmllink This is paragraph 1. It was a quiet day for all the quitters. Now is the time for all the good men to go to aid of the party.The quick brown fox jumps over the lazy dog. This is paragraph 2. It was a quiet day for all the quitters. Now is the time for all the good men to go to aid of the party.The quick brown fox jumps over the lazy dog.
17
Header elements Use the to elements to delineate sections of a document linkheader.htmllink Heading 1 Heading 2 Heading 3 Heading 4
18
Logical Highlighting … - emphasis (usually italics) … - stronger emphasis (usually boldface) linklinklogical html
19
Physical Highlighting … - italics … - bold … - subscript … - superscript linklinkphysical.html
20
Special Characters << >> && "“
21
Misc. elements Comments: Horizontal rule:
22
Images Inserted using element Src attribute specifies file containing the image to insert Alt attribute specifies the text to display when the browser can’t render the image E.g. linkbill1.htmllink Speedy Bill
23
Resizing Images Use the “width” and “height” attributes to specify the desired size linkbill2.htmllink linkbill3.htmllink
24
Links Links to other documents are implemented with the … or “anchor” element Href attribute specifies the document to link to E.g linklink.htmllink See Bill drive fast !
25
Block Level Elements Lists Tables Framesets
26
Layout (Block v. Inline) inline elements flow together one after another; a new line is started only if the next element will not fit on the current line block level elements almost always start on a new line
27
Lists (unordered) Produces a bulleted list: … Each item in the list is a … element
28
Lists (ordered) Produces a numbered list: … The browser numbers the items automatically Each item in the list is … element listlist1.html list
29
Tables Creates a rectangular array of cells: … The “border” attribute specifies the width, in pixels, of the border around the table The “cellspacing” attribute specifies the amount of space, in pixels between adjacent cells The “cellpadding” attribute specifies the amount of space, in pixels between a cell and its own contents
30
Rows and Cells A “table” element contains one or more rows: … The first “tr” element usually contains one or more heading cells: … The remaing row elements are composed of one or more regular cells: … linktable1.html link
31
Cell Spanning By default all cells are the same size and shape The “rowspan” attribute allows a cell to cross two or more rows The “colspan” attribute allows a cell to cross two or more columns linktable2.htmllink
32
Definition Lists … definition list – … term being defined – … definition linkdefinition_list.htmllink Dweeb young excitable person who may mature into a Nerd or Geek Hacker a clever programmer Nerd technically bright but socially inept person
33
Framesets Used to display 2 or more entire web pages within a single window … Rows attribute – the number and style of rows to divide the window into Cols attribute – the number and style of columns to divide the window into
34
Frame Identifies the HTML document to place inside a frame Src attribute identifies the HTML file to display in the frame Name attribute names the frame so that it can be targetted by an anchor (link)
35
Frameset Example
36
Links (Anchors and frames) To have a link in one frame change the file in another frame, use the “target” attribute of the “img” tag E.g Image 1
37
Cascading Style Sheets Separates content from presentation Used to globally alter the presentation of elements in a document E.g definition lists linkdefinition_list.htmllink –With font elements linkdl_with_font.htmllink
38
CSS Syntax Styles are defined within a … element within the … element of the document E.g. dt { color: red }
39
Syntax dt { color: red } selector property name value link dl_with_css
40
Selector name of an element,, dt {...} name of a class.pastoral {...} name of an ID attribute h1#main_section {...}
41
Common Properties Amount of space to leave inside the element before its content to the left padding-left Amount of space to leave vertically before element margin-top Normal, italic, or obliquefont-style Normal or boldfont-weight background-color Foreground colour color DescriptionName
42
Length units Relative em (ems, the height of the element's font) ex (x-height, the height of the letter "x") px (pixels, relative to the canvas resolution) Absolute in (inches; 1in=2.54cm) cm (centimeters; 1cm=10mm) mm (millimeters) pt (points; 1pt=1/72in) pc (picas; 1pc=12pt)
43
Linked Style Sheets element inside the element
44
Colours 12 bit RGB triplee.g.#47B 24 bit RGB triplee.g#F7342B name: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow
45
Other considerations For filenames, stick to lowercase, numbers and underscores ‘_’ Use the proper extension: –.html for HTML –.gif,.jpg for images ‘src’ and ‘href’ attributes are relative to the current document
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.