html code html can be written on the simplest text programs. a web page is defined by the tag
TRANSCRIPT
HTML Code
•HTML can be written on the simplest text programs.
•A web page is defined by the <html> 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>
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 />© 2008 and beyond</body></html>
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>
Special Features
• Character Entities http://www.pageresource.com/html/speclist.htm
• <!-- Comments -->
• Background Color<body bgcolor=“FF0000”>
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.
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”>
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>
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>
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