html code html can be written on the simplest text programs. a web page is defined by the tag

10
HTML Code •HTML can be written on the simplest text programs. •A web page is defined by the <html> tag

Upload: lee-brooks

Post on 15-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

HTML Code

•HTML can be written on the simplest text programs.

•A web page is defined by the <html> tag

Page 2: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

Tags

• The commands that make HTML work are called tags

• Tags are distinguished by their < and > characters.

• Any time you open a tag <html> you have to close it </html>

Page 3: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

Try this<html><head><title> My coding example</title></head><body><h2> I’ve written this page with code</h2>Hello, <i>World Wide Web!</i> <!-- Notice how clever I’m being --><p> Please visit<br /><a href=http://home.utah.edu/~u0471903>my home page</a><p>Composed with care by:<cite>Keith</cite><br />&copy; 2008 and beyond</body></html>

Page 4: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

Proper Nesting

• Tags must be properly “nested.”

• End tags by starting with the most recent and work your way back out.

• “First in, last out”

<a href=“another_doc.html”>A link, some of which <b><i>is emphasized</i></b></a>

Page 5: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

Special Features

• Character Entities http://www.pageresource.com/html/speclist.htm

• <!-- Comments -->

• Background Color<body bgcolor=“FF0000”>

Page 6: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

Separating Sections

• <div> divides the document into separate, distinct sections. Can be labeled for reference for other tags, for example with the id attribute. <div id=“abstract”>

• <p> signals the start of a new paragraph, giving a blank line plus extra vertical space. Separate paragraphs can be aligned differently. <p align=right>

• <br> is a simple line break.

Page 7: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

Text Elements

• Size. <font size=“7”>H</font>ey!– Can be value from 1 – 7

• Color. <font color=“#FFFF00”>Sunny</font> <font color=“blue”>skies</font>

• Horizontal Line. <hr>– Can be adjusted. <hr size=“36” width=“50%”

align=“center”>

Page 8: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

Images

• The code must reference the image source. <img src=“images/portrait.jpg”>

• Images can be aligned with code.<img src=“images/portrait.jpg” align left> And then write

text that will wrap around it.

• You can choose to make it a link, with or without a border.

<a href=“text.html”> <img src=“images/portrait.jpg” border=“3” /></a>

Page 9: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

Lists• Unordered Lists <ul><ul> <li>one example</li> <li>second example <ul> <li>third example is nested<li> </ul> </li></ul>

• Ordered Lists <ol><ol type=“1”> <li>Capital letters is type A</li> <li>lowercase is type a</li> <li>Capital Roman is type I</li> <li>lowercase roman is type i</li></ol>

Page 10: HTML Code HTML can be written on the simplest text programs. A web page is defined by the tag

XHTML Needs

• All elements nested correctly

• End tags for all tags, including empty elements

• Case sensitivity. A is not a

• Quoted attribute values <table rows=“3”>

• Make use of special character entities