1-02: HTML Markup Introduction

1,016 views
967 views

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,016
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
28
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • This lesson we’ll expand on the content layer – HTML – which is all the structure and content of the web.
  • Last lesson we covered the basics of the layers of web development, and how important it is to separate everything for ease of development. It allows all our technologies to work neatly together.
  • Introduction:Welcome to HTML!Here we're going to start introducing HTML as a language and understanding how it forms the building blocks of the elements on a web page. These elements on a page, can convey anything from information, to lists and even input. As a language, HTML has been designed to provide us the ability to include many different types of things for presentation on the web. Over the course of time, more and more elements and their practical use will be demonstrated as well as the theory of how they all link together to form a seamless web experience that we enjoy on a daily basis. What is HTML?HTML (HyperText Markup Language) is literally the language used to create web page documents. The updated version, XHTML (eXtensible HTML) is essentially the same language with stricter rules in how it's written and understood by browsers.What we will actually be concentrating on is XHTML for our course but we'll refer to the differences between these derivative languages as we go, and when we recap the course at points. PS: If someone mentions "(X)HTML" they collectively mean both HTML or XHTML. Firstly, and possibly the most important thing to remember about (X)HTML itself is that it's not a programming language. (X)HTML is a markup language which means it defines a way of identifying and describing parts of a document. Markup is essentially the bits and pieces of a document which you see (or don't see!) through a browser - such as headings, paragraphs, buttons, structural divisions, etc. Markup language doesn't define any programming logic, it defines what's on the page. In order to get a basic understanding of the language, going to write some pages and code snippets by hand in this course, as it's the best way to learn.
  • Document overview:When you punch in a URL into your web browser or click on a hypertext link such as http://finda.com.au, your browser asks our servers to send back what web content it finds at that address. What the browser gets back is an (X)HTML formatted document. Document is the term that describes the full page and all it's associated bits and pieces. Everything that makes up the page you see when rendered is "marked-up" in that document.
  • Meet (X)HTML!Here is some example source code for a very basic (X)HTML document.You can see that the above example contains the text that will be displayed to the viewer of the page, but it also contains special tags (indicated with angle brackets, < and >) that describe each text element on the page.Adding descriptive tags to a text document in this way is known as “marking up” the document.
  • The HTML Element:The bracketed tags contained in the document as shown are known as elements, and these tags all follow this convention.
  • Element names are usually lowercase, as XHTML requires it. And as we use and teach XHTML primarily over HTML, we will be using these stricter rules. The (X)HTML syntax was created especially for documents with hypertext links. HTML defines dozens of text elements that make up documents such as headings, paragraphs, emphasized text, and of course, links. These elements are used according to "semantic markup" - the type of tag used, provides information to that bit of content's relevancy or use. Examples of these can be seen in the <h1></h1> tags which specifies the most important heading on the page and the <p></p> tags which define a paragraph.
  • Elements don't always have content, and some never have content - they are referred to as empty elements! They are written differently if they are empty. Empty tags are closed by adding a trailing slash preceded by a space before the closing bracket, like so:<img />, <br />, and <hr /> There are also HTML elements that add information about the document (such as its <title>) and that add media such as images, videos, Flash movies, or applets to the page.
  • Structure of the document is required, and some fields like <title> are a required element of an XHTML page. In XHTML, all elements, including empty elements, must be closed (or terminated, to use the proper term). They all need their </blah> if in a pair... or <blah /> if they are an empty element.
  • The structure of an (X)HTML document is a heirarchy, and in it's most basic sense everything is contained inside the <html></html> tags. The <HTML> tag is known as the root element, because it contains everything else, as well as defines that everything inside will be the further markup of the document. After that, we move one level down, and see the  <head></head> and <body></body> tags - Humans have a head and a body, and so do (X)HTML documents.The head area is where we define various properties of the document such as it's title (which is required), and also set up linkages to any CSS files and javascript files the document may use. The body is where we specify all the main content, and inside of it, are all our base elements such as headings and paragraphs.These tags don't specify how anything in the document looks, but they are required to be there in order to play by the XHTML rules and be "vaild" as a document.
  • Attributes:We now know about elements, but in order to make some elements useful, we need to apply attributes to them so they can perform their role. For example, An <img /> (image) tag is not very useful by itself... there’s no way to know which image to use! That’s where attributes come in. "Attributes are instructions that clarify or modify an element." For the img element, the src (short for “source”) attribute is required, and provides the location of the image file via its URL. The syntax for attributes is as follows:<element attribute-name="value">Content</element> or for empty elements (less commonly):<elementattribute-name="value"/> 
  • For our image element example we can check the graphic. There are a variety of different tags for different elements, some are common, and others are only used on certain tags. We'll examine certain tags individually later.
  • Block and Inline elementsYou may have noticed in the past that heading and paragraph elements start on new lines and do not run together as other text can. That is because they are examples of block-level elements. Browsers treat block-level elements as though they are in rectangular boxes, stacked up in the page top to bottom. Each block-level element begins on a new line, and some space is also usually added above and below the entire element by default. If you open an example in firefox, and use the firebug plugin, you can clearly see the outlines as you select them. By contrast, if you check content that is marked up with a <span> element or as emphasized with an <em>, you will see that it does not start a new line, but rather stays in the flow of the paragraph. That is because the em element is an inline element. Inline elements do not start new lines; Boxes are drawn around them in firebug to show that they just go with the flow of text.  The difference between block-level and inline elements is important. In (X)HTML markup, whether an element is block-level or inline restricts what other elements it may contain and where it will end up being positioned. For example, you can’t logically put a block-level element within an inline element (such as a paragraph within a link). Blocklevel and inline elements also behave differently when it comes to applying Cascading Style Sheet (css) properties.
  • Special CharactersThere's a bunch of common characters, like the copyright symbol ©, that aren't part of the normal set of ASCII characters which are used on the web. The normal set has only letters, numbers, and a few basic symbols. You may see a problem with that however, since if you put one in an (X)HTML document, the browser will think it's the beginning of a tag. If we have special character we need to substitute it. You can represent it by its numeric or named character reference for the web. When the browser sees the character reference, it substitutes the proper character in that spot when the page is displayed. There's a few ways to do this: by an assigned numeric value (numeric entity) or using a predefined abbreviated name for the character (called a named entity). All character references begin with a “&” and end with an “;”. Say we wanted to add the copyright symbol ( © ) to the page... in XHTML we must use the named entity & copy ; (or its numeric equivalent & # 169 ; ) where we want the symbol to appear. NOTE: There is to be no spaces between the & and the closing semicolon - i just can't write them here in the wiki because it treats them as the characters otherwise! That's how well it works!An example of the html for inserting a copyright symbol: <p>All content copyright & copy ; 2007, Jennifer Robbins</p>or:<p>All content copyright & # 169 ; 2007, Jennifer Robbins</p>  A common mistake is the & symbol, which should be & amp ; .This is just a restriction of adding propper content for the web. 
  • There's hundreds of equivellant characters, and they can all be found on various standards websites like http://www.webstandards.org/learn/reference/charts/entities/http://www.webmonkey.com/2010/02/special_characters/ 
  • 1-02: HTML Markup Introduction

    1. 1. HTML – Markup Introduction<br />Colin Gourlay & Kevin Vanderbeken<br />
    2. 2. HTML<br />=<br />(the content layer)<br />
    3. 3. Last week we said...<br />separate your content, presentation & behaviour <br />It eases our development, with multiple people, and allows all our technologies to work nicely together.<br />
    4. 4. Today:<br />Basic HTML Concepts:<br />Document overview - Meet HTML!<br />HTML Syntax - tags, html, xhtml attributes<br />Block & Inline - <DIV>'s and <SPAN>'s<br />Special characters.<br />
    5. 5. What is HTML...<br />Hypertext Markup Language<br />The building block of elements in a web document.<br />A language designed to allow us to put many kinds of things on the web.<br />Has a few variations through different standards: HTML and XHTML – We’re doing XHTML, it’s stricter.<br />Not a programming language! Markup languages describe parts (in a document).<br />It’s the bits of a document in a language a browser can understand.<br />
    6. 6. The document...<br />Browser goes to http://finda.com.au<br />Gets back an XHTML formatted (“marked-up”) document.<br />‘Document’ is a term that describes the page and all it’s associated bits and pieces.<br />
    7. 7. Meet XHTML...<br /><html><br /><head><br /><title> This is my title. </title><br /></head><br /> <body><br /><h1>Hello World!</h1><br /><p>I am a very basic page. <br /> Use your back button to <br /> get out of here.</p><br /></body><br /></html><br />
    8. 8. What are all these brackets?!<br />Part of the HTML Syntax:<br />The bracketed tags are elements.<br />
    9. 9. The HTML Element<br />Required to be lowercase in XHTML.<br />XHTML defines dozens of text elements that make up documents:<br />Headings<br />Paragraphs<br />Emphasised text<br />Links<br />Etc.<br />Used according to it’s semantic markup: type of tag used provides information to the relevancy or type of content that it’s holding. Eg. Headings <h1><br />
    10. 10. The HTML Element (cont..)<br />Elements don't always have content!<br />Empty tags are closed by adding a trailing slash preceded by a space before the closing bracket:<br /> <img />, <br />, and <hr /><br />There are HTML elements that add information about the document (such as its <title>).<br />Some add media such as images, videos, Flash movies, or applets to the page.<br />
    11. 11. Document Requirements<br />The base structure of the document is required, and some fields like <title> are a required element of an XHTML page.<br />In XHTML, all elements, including empty elements, must be terminated (closed). They all need their </blah> if in a pair... or <blah /> if they are an empty element.<br />
    12. 12. Structure of an XHTML document<br />We saw it before – essentially the document is a hierarchy.<br /><ul><li>Everything is inside the <html> </html> tags.
    13. 13. In head: define properties of the document and linkages to css and js.
    14. 14. In body: All the content we want the page to display.</li></li></ul><li>Attributes: Making tags more useful!<br />“Attributes are instructions that clarify or modify an element.”<br /><element attribute-name="value">Content</element><br /> <br />or for empty elements (less commonly):<br /><element attribute-name="value"/><br /><ul><li>In this way we can tell the browser things like, “This image element has it’s actual image file stored here.”</li></li></ul><li>
    15. 15. Block and Inline elements:<br />It’s all about boxes around things!<br />Block level elements: Treated as boxes stacked up in the page top to bottom. <div>, <p>, etc.<br />Inline elements: do not start a new line, but stay in the flow of content. <span>, <em>, <a>, etc.<br />
    16. 16. Block and Inline elements:<br />It’s all about boxes around things!<br />Block level elements: Treated as boxes stacked up in the page top to bottom. <div>, <p>, etc.<br />Inline elements: do not start a new line, but stay in the flow of content. <span>, <em>, <a>, etc.<br />Whether an element is block or inline restricts what other elements it may contain and where it will end up being positioned.<br />
    17. 17.
    18. 18. Special Characters:<br />Some text characters need to be written using a html character substitute because they would not be understood by html or they might be misinterpreted as markup.<br />© , & and < are examples of this!<br />You can represent it by its numeric or named character reference for the web.<br />Two options: by an assigned numeric value (numeric entity) or using a predefined abbreviated name for the character (called a named entity). <br />All character references begin with a “&” and end with an “;”.<br />
    19. 19.
    20. 20. how’s our speed?<br />
    21. 21. email us...<br />kevin.vanderbeken@apn.com.au<br />colin.gourlay@apn.com.au<br />
    22. 22. next week...<br />
    23. 23. CSS INTRO<br />

    ×