Академический Документы
Профессиональный Документы
Культура Документы
Content
1. HTML Basic 2. Structured Document 3. DOM (Document Object Model) 4. Common HTML Elements
Content
1. HTML Basic 2. Structured Document 3. DOM (Document Object Model) 4. Common HTML Elements
set of annotations to text that describe how something is to be structured with references (hyperlinks) to other text that the reader can immediately access, usually by a mouse click or key press sequence
4
Hypertext
text
HTML Example
<html> <head> h d <title>Test Page</title> </head> <body> g / <h1>Test Page</h1> <p>This is a test page.</p> </body> </html>
5
Element
<h1>Test page</h1>
Opening tag or Start tag Content Closing tag or End tag
Attribute
Most
Hyperlink
A link from a document to another document Anchor element with href attribute
href has a URI, an absolute path or a relative path Example: <a href= href=http://www http://www.yahoo.com/ yahoo com/>Yahoo!</a> >Yahoo!</a>
Yahoo!
Images
Images (2)
Insert image
<img src src= = image.ext> image ext> <img src src= = folder/image.ext> E.g. <p><img <p><img src src= = awards.jpg>
10
Content
1. HTML Basic 2. Structured Document 3. DOM (Document Object Model) 4. Common HTML Elements
2. Structured Document
Most
Article
Title,
CV
Name,
Markup
11
12
html <html> <head> head <title>Test</title> title </head> <body> <b d > body <h1>Test</h1> h1 <p>Paragraph</p> </body> p </html>
example
Test
example
Test Paragraph
13
14
Content
1. HTML Basic 2. Structured Document 3. DOM (Document Object Model) 4. Common HTML Elements
root of document
<head>
meta, , link, ,
<body>
content of document
h1 h1-h6,
p, address,
15 16
3. DOM (2)
DOM
in JavaScript
DOM representation
Logical tree structure Hierarchy of node objects root: Document Node: Element, Attr, Text,
E.g. get all of paragraphs in the document and display the first one of them var paragraphs = document.getElementsByTagName(p"); alert(paragraphs[0].nodeName);
17
18
Content
1. HTML Basic 2. Structured Document 3. DOM (Document Object Model) 4. Common HTML Elements
19
20
4.1. List
Unordered
Unordered List
<ul> <li>Apple</li> <li>Banana</li> <li>Grape</li> </ul> Attributes: TYPE
21
22
<UL TYPE="DISC"> <LI>The UL tag <UL TYPE="CIRCLE"> <LI>TYPE <UL TYPE="SQUARE"> <LI>DISC <LI>CIRCLE <LI>SQUARE </UL> <LI>COMPACT </UL> <LI>The LI tag <UL TYPE="CIRCLE"> <LI>TYPE Q <UL TYPE="SQUARE"> <LI>DISC <LI>CIRCLE <LI>SQUARE </UL> <LI>VALUE </UL> </UL>
Ordered List
<ol> <li>One</li> <li>Two</li> <li>Three</li> </ol> /
1. 2. 3. One Two Three
23
24
<OL TYPE="I"> <LI>Headings <LI>Basic Text Sections <LI>Lists <OL TYPE="A"> <LI>Ordered <OL TYPE="1"> <LI>The OL tag <OL TYPE="a"> <LI>TYPE <LI>START <LI>COMPACT </OL> <LI>The LI tag </OL> <LI>Unordered <OL TYPE="1"> <LI>The UL tag <LI>The LI tag </OL> / <LI>Definition <OL TYPE="1"> <LI>The DL tag <LI>The DT tag <LI>The DD tag </OL> </OL> <LI>Miscellaneous </OL>
Definition List
<dl> <dt>Apple</dt> <dt>A l </dt> <dd>A fruit or a computer company</dd> <dt>Grape</dt> <dd>A juicy purplepurple - or greengreen -skinned fruit</dd> </dl>
Apple A fruit or a computer company Grape A juicy purple- or green-skinned fruit
25
26
4.2. Table
<table> <caption>Users</caption> Users <tr> Name Email <th>Name</th> <th>Email</th> John Smith smith@example.org </tr> Amy Wine amy@yahoo.com <tr> <td>John Smith</td> <td>smith@example.org</td> </tr> / <tr> <td>Amy Wine</td> <td>amy@yahoo.com</td> </tr> </table>
27
Adding a border
<table border=10> border 10>
28
left, right or center top, bottom, middle or baseline C Cellspacing=n, ll i where h ni is th the number b of f pixels desired between each cell <table cellspacing=8>
29
30
<tr> <!-<!-- first row ---> > <td> data 11 </td> <td > data 12 </td> </tr> <tr> <!-<!-- second row ---> > <td> Data 21 </td> <td> d Data 22 </td> / d </tr> <tr> <!-<!-- third row ---> > <td colspan=2> Data 3 last row??? </td> </tr> </table>
<table border= 2 bordercolor=green align=left> <tr> <!-<!-- first row ---> > <td> data 11 </td> <td > data 12 </td> </tr> <tr> <!-<!-- second row ---> > <td rowspan=2> p Row 23 </td> <td> Data 21 </td> </tr> <tr> <!-<!-- third row ---> > <td > Data 31 </td> </tr> </table>
31 32
4.3. Emphasis
<p> Here is an emphasized <em>paragraph</em> </p> <p>
This is a strongly emphasized <strong>text</strong>
4.4. Quote
Short quote: <q>
includes only text IE 8 doesnt support <q> <p>He said, <q>Im lucky</q>.</p>
</p>
33
34
35
36
Question?
37
10