200 likes | 451 Views
HTML Basics. ICS 415 Cam Moore 29 Aug 2013. What is HTML. Hypertext Markup Language Basis for the World Wide Web ASCII Text document Used by Web browsers to present text and graphics HTML documents include markup tags and plain text to describe the contents of the document.
E N D
HTML Basics ICS 415 Cam Moore 29 Aug 2013
What is HTML • Hypertext Markup Language • Basis for the World Wide Web • ASCII Text document • Used by Web browsers to present text and graphics • HTML documents include markup tags and plain text to describe the contents of the document
HTML Versions • HTML – 1991 • HTML+ – 1993 • HTML 2.0 – 1995 • HTML 3.2 – 1997 • HTML 4.01 – 1999 • XHTML 1.0 – 2000 • HTML5 – 2012 • XHTML5 – 2013
Basic HTML Page <!DOCTYPE html> <html> <head> <title>Basic HTML Page</title> </head> <body> <h1>Heading 1</h1> <p>First paragraph … </p> <a href=“link.html”>Link</a> </body> </html>
DOCTYPE • Defines the document type. • HTML5 • <!DOCTYPE html> • HTML 4.01 • <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> • XHTML 1.0 • <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transistional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transistional.dtd”>
HTML Tags • HTML tags are keywords surrounded by <> • <html>, <head>, <title>,… • Normally come in pairs <html>…</html> • Define HTML Elements • Basic tags: • Structure <html>, <head> and <body> • Headings <h1>, <h2>, …, <h6> • Paragraph <p> • Links <a href=“/”>Link</a> • Images <imgsrc=“hi.png”> • Comment <!-- This is a comment --> • Tags should be lower case and be closed • See: http://www.w3schools.com/tags/default.asp
HTML Attributes • HTML Elements may have Attributes • Attributes provide additional information about HTML Elements • Specified in the start tag of the element • Name/Value pairs • name=“value” • Should be quoted ‘Carleton “Cam” Moore’ • Should be lower case • Standard Attributes: • class – one or more class in a style sheet • id – unique id for the element • style – inline CSS style for the element • title – extra information about the element (tooltip)
HTML Head Element • The <head> element is a container for heading elements • <title> - the title of the document • <style> - defines style information for the document • <meta> - metadata about the document • <link> - defines relationship to external resource • <script> - client-side script, such as JavaScript • <noscript> - displays message if scripting is disabled in the client • <base> - specifies the base URL/target for all URLs in the page
HTML Lists • Ordered Lists (Numbered) • <ol> • <li> • Unordered Lists (Bullets) • <ul> • <li> • Description Lists • <dl> • <dt> • <dd>
HTML Blocks • <div> is a block element that can contain other HTML elements • <span> is an inline element that can contain other HTML elements • Mostly used for styling via CSS
HTML Forms • Forms are used to pass information to a Server • <form> • <input> • <textarea> • <button> • <select> • <option> • <filedset> • <label>
Form Example • <form name=“input” action=“example.html” method=“get”> • Username: <input type=“text” name=“user”> • <input type=“submit” value=“Submit”> • </form>
Input types • Text • <input type=“text” name=“firstname”> • Password • <input type=“password” name=“pwd”> • Radio Button • <input type=“radio” name=“sex” value=“male> • Checkbox • <input type=“checkbox” name=“vehicle” value=“Car”> • Submit Button • <input type=“submit” value=“Submit”>
HTML Iframes • Iframes are used to display web pages within a web page • <iframesrc=“URL”></iframe>
HTML Frames • HTML Frames allow independent windows or subwindows • <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN” “http://www.w3.org/TR/html4/frameset.dtd”> • The <frameset> element replaces the <body> element • Attributes: rows, cols • %, pixels, *(remainder) “1*,250,3*,10%”
HTML Frames (cont) • <frame> elements inside <frameset> element • Attributes: • name – name of frame for targeting • src – URL source for frame content • frameborder – 0|1 hide or show border • marginwidth – in pixels • marginheight – in pixels • See http://www.w3.org/TR/html401/present/frames.html for more