html 1
play

HTML 1 CS 337 - Web Programming University of Arizona - Spring 2014 - PowerPoint PPT Presentation

HTML 1 CS 337 - Web Programming University of Arizona - Spring 2014 Day 1 Review There are four main technological elements used in a majority of websites Design Interaction Logic Database (HTML & CSS) (JavaScript) (PHP/ (MySQL/


  1. HTML 1 CS 337 - Web Programming University of Arizona - Spring 2014

  2. Day 1 Review There are four main technological elements used in a majority of websites Design Interaction Logic Database (HTML & CSS) (JavaScript) (PHP/ (MySQL/ ASP.NET/ SQL Server/ Java) Oracle) CS 337 - Web Programming University of Arizona - Spring 2014

  3. Learning Objectives • At the end of this lesson you should be able to: o Explain how to use comments, the concept of elements and tags, and indention o Name, explain the purpose, and provide the correct order of the required declarations and elements of an HTML document o Explain the difference between block elements and inline elements and two generic tags that represent them. CS 337 - Web Programming University of Arizona - Spring 2014

  4. HTML Pages Naming a file: • End with .html • No spaces • Only alpha-numeric characters for best results • Can use dashes – • example.html • example-page.html CS 337 - Web Programming University of Arizona - Spring 2014

  5. Comments Browser View Comments are started with a <!-- and end with --> Example: <!-- This is a comment --> CS 337 - Web Programming University of Arizona - Spring 2014

  6. HTML Tags • HTML is a markup language • This means that it is a language designed to be machine-readable • All design elements of an HTML page use tags with the ability to define attributes and the text in the element • A tag is represented by < and > • Tags should be lowercase CS 337 - Web Programming University of Arizona - Spring 2014

  7. HTML Tags • For example, if I wanted to tell the machine reading my page that I want it to define paragraph, I would put the word paragraph in a tag • Example: <paragraph> CS 337 - Web Programming University of Arizona - Spring 2014

  8. HTML Tags • All tags should be closed so the machine knows where the end of the tag is • Tags are closed similarly to how they are opened except there is a / before the name of the tag • Together, these make an HTML element • Example: <paragraph> </paragraph> CS 337 - Web Programming University of Arizona - Spring 2014

  9. HTML Tags Browser View • The text you put between the opening and closing tags (inside an element) is displayed to the user • Example: <paragraph>Hello World</paragraph> CS 337 - Web Programming University of Arizona - Spring 2014

  10. HTML Tags • You can also define attributes about an element by putting the attribute in the opening tag and defining it. • Example: <paragraph name="myParagraph"> Hello World </paragraph> CS 337 - Web Programming University of Arizona - Spring 2014

  11. HTML Tags • As programmers try to use smaller names for standard tags so it is faster to type • In the case of a paragraph, p is used • Example: <p>Hello World</p> CS 337 - Web Programming University of Arizona - Spring 2014

  12. Indentation Browser View • Elements can be nested • When nested, they should be indented by human readability <p>Hello World <p> Goodbye World </p> </p> CS 337 - Web Programming University of Arizona - Spring 2014

  13. Learning Objectives • At the end of this lesson you should be able to: o Explain how to use comments, the concept of elements and tags, and indention o Name, explain the purpose, and provide the correct order of the required declarations and elements of an HTML document o Explain the difference between block elements and inline elements and two generic tags that represent them. CS 337 - Web Programming University of Arizona - Spring 2014

  14. Learning Objectives • At the end of this lesson you should be able to: o Explain how to use comments, the concept of elements and tags, and indention o Name, explain the purpose, and provide the correct order of the required declarations and elements of an HTML document o Explain the difference between block elements and inline elements and two generic tags that represent them. CS 337 - Web Programming University of Arizona - Spring 2014

  15. Required Elements • There are two required elements in an HTML document o <!DOCTYPE html> o <title> CS 337 - Web Programming University of Arizona - Spring 2014

  16. Standard Elements • There are three standard elements in an HTML document o <html> o <head> o <body> CS 337 - Web Programming University of Arizona - Spring 2014

  17. <!DOCTYPE html> • A very special, required element • Defines the document as an html document • No closing tag • Must be on the first line of the document CS 337 - Web Programming University of Arizona - Spring 2014

  18. <title> Browser View • Required • Specifies the title of the document <!DOCTYPE html> <title>Example Page</title> CS 337 - Web Programming University of Arizona - Spring 2014

  19. <html> • Specifies the portion of <!DOCTYPE html> the document that <html> contains html (which is <title>Example all of it) Page</title> • It represents the root of </html> the document so that there is an element that contains everything CS 337 - Web Programming University of Arizona - Spring 2014

  20. <head> • Contains elements <!DOCTYPE html> about the HTML <html> <head> document itself <title> • Not for elements that Example should be displayed to Page the user </title> • There should only be </head> one head element </html> CS 337 - Web Programming University of Arizona - Spring 2014

  21. <body> • Contains all of the elements designed to be displayed to the user • There should only be one body element CS 337 - Web Programming University of Arizona - Spring 2014

  22. <body> <!DOCTYPE html> <html> <head> <title>Example Page</title> </head> <body> <p>Hello World!</p> </body> </html> CS 337 - Web Programming University of Arizona - Spring 2014

  23. Recommended Elements • There are two recommended elements in an HTML document o <meta> o <meta> • Actually it is the same element used twice with different attributes CS 337 - Web Programming University of Arizona - Spring 2014

  24. Recommended Elements • <meta charset="UTF-8" /> o Defines the character set of you HTML file • <meta name="description" content="This is an example page"> o Defines the description of the page to be used by search engines • There are other meta attributes that can be used, but aren’t as common CS 337 - Web Programming University of Arizona - Spring 2014

  25. Meta Description CS 337 - Web Programming University of Arizona - Spring 2014

  26. Header ... <head> <title>Example Page</title> <meta charset="UTF-8" /> <meta name="description" content="This is an example page"> </head> ... CS 337 - Web Programming University of Arizona - Spring 2014

  27. Body Structure • While not required, there are some elements commonly used to structure the body of a website <header> <article> <nav> <aside> <section> <footer> CS 337 - Web Programming University of Arizona - Spring 2014

  28. Body Structure CS 337 - Web Programming University of Arizona - Spring 2014

  29. Partner Activity CS 337 - Web Programming University of Arizona - Spring 2014

  30. Learning Objectives • At the end of this lesson you should be able to: o Explain how to use comments, the concept of elements and tags, and indention o Name, explain the purpose, and provide the correct order of the required declarations and elements of an HTML document o Explain the difference between block elements and inline elements and two generic tags that represent them. CS 337 - Web Programming University of Arizona - Spring 2014

  31. Learning Objectives • At the end of this lesson you should be able to: o Explain how to use comments, the concept of elements and tags, and indention o Name, explain the purpose, and provide the correct order of the required declarations and elements of an HTML document o Explain the difference between block elements and inline elements and two generic tags that represent them. CS 337 - Web Programming University of Arizona - Spring 2014

  32. Block vs. Inline • There are two types of display elements o Block o Inline CS 337 - Web Programming University of Arizona - Spring 2014

  33. Block • If no width is set, will expand naturally to fill its parent container • Can have margins and/or padding • If no height is set, will expand naturally to fit its child elements • Will be placed below previous elements • Introduces a carriage return after CS 337 - Web Programming University of Arizona - Spring 2014

  34. Block CS 337 - Web Programming University of Arizona - Spring 2014

  35. Inline • Flows along with text content • Will not drop to the next line • Will ignore top and bottom margin settings, but will apply left and right margins, and any padding • Will ignore the width and height properties CS 337 - Web Programming University of Arizona - Spring 2014

  36. Inline CS 337 - Web Programming University of Arizona - Spring 2014

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend