intro to html

15
introduction to html Basic syntax and elements

Upload: gerson-abesamis

Post on 24-May-2015

1.501 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Intro to HTML

introduction to htmlBasic syntax and elements

Page 2: Intro to HTML

what is html?• HTML: Hyper Text Markup Language• Language which defines webpages• Structure• Appearance• Description

• Worldwide standard• Composed of HTML tags

Page 3: Intro to HTML

html tags• Basic unit of an HTML document• Contained in brackets: <tag>• Usually in pairs• Opening: <tag>• Closing: </tag>

Page 4: Intro to HTML

Basic Structure• HTML document: <html></html>• Head: <head></head>• Body: <body></body>

Page 5: Intro to HTML

Basic Structure<html><head><!-- document information goes here --></head><body><!-- visible content goes here --></body>

</html>

Page 6: Intro to HTML

Basic Elements • Headings: <h1></h1>...<h6></h6>• Paragraphs: <p></p>• Links (anchors): <a></a>• Images: <img />• Line breaks: <br />

Page 7: Intro to HTML

HTML Syntax • Two types of elements:

1.Container elements• Has content inside <p>Hello world</p>• Closed by a closing tag </p>

2.Empty elements• Content in itself <img src=“hi.gif” />• Self-closing <br />

• Elements can have attributes

Page 8: Intro to HTML

Coding Tips• Always close the element• <h1>Header</h1>, <br />

• Use lower case• <p>, <body>, <html>

• First-opened, last-closed• <p><a href=“#”>Link</a></p>

• Always quote attributes• <img src=“major.jpg”>

Page 9: Intro to HTML

TExt-formatting• Bold: <b>Bold text</b>• Italic: <i>Italicized text</i>• Big: <big>Big text</big>• Small: <small>Small text</small>• Emphasized: <em>Emphasized text</em>• Strong: <strong>Strong text</strong>• Subscript: <sub>Subscript text</sub>• Superscript: <sup>Superscript text</sup>

Page 10: Intro to HTML

Anchor Attributes• Destination file/location• Another webpage: <a href=“sample.html”>• Open a picture: <a href=“me.jpg”>• Go to an area: <a href=“#chapter”>

• Where to open the link• New window: <a target=“_blank”>

• Declare an anchor-area: <a name=“chapter”>

Page 11: Intro to HTML

image attributes

• Location and filename: <img src=“hi.gif” />• Alternative text: <img alt=“My First Dog” />

Page 12: Intro to HTML

tables• Declare a table: <table>...</table>• Define a row: <tr>...</tr>• Add divisions/cells: <td>...</td>• Put content inside the cells: <td>Content</td>

Page 13: Intro to HTML

Sample Table Code<table><tr><td>Name</td><td>Occupation</td></tr><tr><td>Gloria</td><td>Thief</td></tr>

</table>

Page 14: Intro to HTML

Lists

• Ordered list: <ol>...</ol>• Unordered list: <ul>...</ul>• List item: <li>Music</li>

Page 15: Intro to HTML

Sample List Code<ol><li>Charm</li><li>Electron</li><li>Gluon</li><li>Graviton</li><li>Muon</li><li>Photon</li><li>Tau</li><li>Truth</li>

</ol>