Presentation is loading. Please wait.

Presentation is loading. Please wait.

HTML – Introduction to the Code

Similar presentations


Presentation on theme: "HTML – Introduction to the Code"— Presentation transcript:

1 HTML – Introduction to the Code

2 WEB PAGE A plain text document (no specific software needed) HTML Tags - describes a documents structure Saved with .htm or .html extension Hosted on a server

3 HTML: Hypertext Markup Language Simple, universal mark-up language used to publish content on the web Standard mark-up language for web pages Uses tags to identify content : <p> I am a paragraph </p> HTML: basic structure Enhanced & Modified by other technologies CSS: presentation, formatting, layout JavaScript: control behavior of page elements PHP: powerful applications/functionality (backend) CMS: manage site content

4 HTML Elements (container tags – markup + content)
Empty Tags (standalone)

5 HTML HTML Markup Element HTML Tags placed in angle brackets <>
Consist of two tags: Opening tag | Closing tag (“on” & “off”) End tag begins with a slash ( / )

6 HTML Empty Tag (Standalone) Do not have text content
Places an element on the page (provides a directive) Indicated by single tag XHTML note: all standalone tags require closing tag (ex: <br> now <br />)

7 HTML Attributes: Information or instructions that modify a tag
Attributes use values Located in the opening tag One tag can have multiple attributes

8 HTML

9 HTML Basic HTML Structure
1) <!DOCTYPE html> identifies the document as an HTML document 2) <html>…</html> (root element) First and last tag in a document 3) <head>…</head> Includes descriptive info about your document | Non visual elements (metatags, links to external resources, scripts or internal resources) 4) <meta charset= “utf-8”> character encoding 5) <title>…</title> Name of page (bookmarks, browser indexing) 6) <body>…</body> Contains visual & structural elements (visible on page)

10 HTML4.01|XHTML1.1|HTML5|HTML??
the many flavors of HTML….

11 HTML Versions Many versions of HTML Tim Berners-Lee
Simple, text-only browsing & authoring system to share and manage information using the hypertext process to link to related documents Handful of tags Web content grew (Browsers made a mess of things) Browser developers implemented new features and new tags into their browsers HTML continued to grow – new, cool, exciting tags (<background>, <font>, <bgsound>, <blink>, <image>) Each browser created its own proprietary tags – only supported by that particular platform W3C stepped in to help ( Oversees ongoing development of the web Keeps track of browser features Help develop guidelines for common HTML language (HTML ) (versions:

12 HTML Versions HTML 2.0 - specification released in 1995
HTML tags - informal CERN document listing 12 tags (1991) HTML specification released in 1995 HTML first version developed and standardized exclusively by the W3C (1996) HTML published as W3C recommendation (1997) HTML published as W3C recommendation (1999) XHTML published as W3C recommendation (2000) More structure less presentation (XML based approach) XHTML published as W3C recommendation (2001) XHTML NO STANDARD ( ) worked on but abandoned – not backward compliant (new language) HTML 5 – WHATWG (Web Hypertext Application Tech Working Group) (2004) W3C adopts the work of this group under name HTML 5.0 (2006) Working Draft (2007)

13 HTML vs. XHTML XML - Extensible Markup Language
A metalanguage for creating markup languages custom markup language to describe all sorts of information (chemical notation, mathematical equations, multimedia presentations, financial information) W3C Vision XML-based Web with many specialized markup languages working together. Enter XHTML - Extensible Hypertext Markup Language HTML rewritten according to the rules of XML (so that it would be compatible with other xml markup)

14 HTML vs. XHTML XHTML - Extensible Hypertext Markup Language
Markup language almost identical to HTML – written with different rules Allows for the markup of text, inclusion of images, and is capable of linking documents together XHTML 1.0/1.1 XHTML is HTML 4.01 Reformatted using the syntax of XML HTML 4.01 – Emphasized the separation of presentation from content structure (presentation handled by CSS) XHTML follows the more structured and rigid XML rules and syntax guidelines enables one document to be viewed on multiple devices (web browsers, cell phones, PDAs, etc) by creating different style sheets for each device. HTML V5 and XHTL V2 Explained:

15 HTML vs. XHTML Syntax Differences
All elements must be terminated (close tag) (Ex: <p> This is XHTML code! </p>) Empty tags must be terminated (close tag) written with a space and / symbol at the end (ex: <br />) All elements and attributes must be in lowercase All attribute values must be contained within quotes All elements must be nested properly

16 XHTML what does it look like?
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” <html xmlns=“ <head> <title>Untitled Document</title> </head> <body> This is where the content of your page will be placed. </body> </html>

17 XHTML what does it look like?
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” DOCUMENT TYPE DECLARATION (DOCTYPE): Defines all elements and attributes in the language & their rules (Identifies which version of html the document follows) Points to a file that outlines the available structure, elements, attributes, and their appropriate usage (URL to a Doc Type Definition (DTD) – machine readable file)

18 DOCUMENT TYPE DEFINITION
Transitional: maintains backward compatibility with older browsers includes legacy elements – obsolete (deprecated) elements (includes presentation elements that were in common use) Strict: doesn’t allow any HTML elements that were designed to control the appearance of a page. (omits all deprecated elements) Frameset: allows HTML elements needed to create framesets. Great explanation can be found at: Child, D. (2004) DTDs Explained, Added Bytes Available: Validators Checks the markup to see if its following the rules specified in the DOCTYPE declaration. Niederst, J. (2012) Learning Web Design. O’Reilly Media, Inc. Chapter 10: What's Up, HTML5

19 XHTML what does it look like?
<html xmlns= lang=“en” xml:lang=“en”> XML namespace= This URL points to a file that gives detailed information about the particular XML vocabulary used on the page.

20 XHTML what does it look like?
<head> contains all the header information <title> defines the page title </title> </head> closing head tag <body> where all visible content will be placed </body> closing body tag </html> closing html tag

21 HTML Versions HTML 2.0 - specification released in 1995
HTML tags - informal CERN document listing 12 tags (1991) HTML specification released in 1995 HTML first version developed and standardized exclusively by the W3C (1996) HTML published as W3C recommendation (1997) HTML published as W3C recommendation (1999) XHTML published as W3C recommendation (2000) More structure less presentation (XML based approach) XHTML published as W3C recommendation (2001) XHTML NO STANDARD ( ) worked on but abandoned – not backward compliant (new language) HTML 5 – WHATWG (Web Hypertext Application Tech Working Group) (2004) W3C adopts the work of this group under name HTML 5.0 (2006) Working Draft (2007)

22 HTML 5 Timeline Can you use it now? – Yes, some parts of HTML 5
2003 – HTML 5 development begins 2007 Oct - First W3C Working Draft 2009 Oct – Last Call Working Draft 2011 – Call for contributions for the test suite 2012 – First draft of test suite 2015 – Second draft of test suite 2019 – Final version of test suite 2020 – Reissued last call working draft 2022 – Proposed Recommendation Ian Hickson, editor of HTML 5 Specification (Tech Republic Interview 2008) Can you use it now? – Yes, some parts of HTML 5 User agents (devices & browsers) provide some support now Entire specification not yet ready for adoption – but some parts are ready to use now Support Resources : | | |

23 HTML 5 vs HTML 4 Differences No Doctype needed <!DOCTYPE HTML>
Character Encoding: <meta charset=“UTF-8” /> New Elements: article, aside, audio, canvas, command, datalist, details, embed, figcaption, figure, footer, header, hgroup, keygen, mark, meter, nav, output, progress, rp, ruby, section, source, summary, time, video Forms: more powerful form elements(built in validation) Integrated APIs (Application Programming Interfaces): Easier to develop web applications across multiple devices. (API = a documented set of commands, data names – lets one software app communicate with another)

24 Back to the Code <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” <html xmlns=“ <head> <title>Title of Document</title> </head> <body> This is where the content of your page will be placed. </body> </html>

25 HTML Common Elements Block & Inline Elements
Block Elements Ex: <p /> <h1>…</h1> Each block element begins a new line Have space above and below the element by default <h1> This is the most important heading </h1> <p> This is a paragraph </p> Inline Elements Ex: <em>…</em> Flow within other elements (do not start new line) <p> This is a paragraph with <em> emphasized text </em> within (inline) the paragraph element </p>

26 HTML Block Level Elements Paragraphs <p>…</p>
Headings <h#>…</h#> (six levels of headings) provides logical hierarchy improves accessibility Block quote <blockquote>…</blockquote> Preformatted text <pre>…</pre> preserves white spaces – returns and character spaces May be needed to convey meaning (code, poetry) Horizontal Rules <hr />

27 HTML Block Level Elements
Unordered Lists <ul>…</ul> & <li>…</li> Default is disc change type: <ul type=“circle”>, “square” Ordered Lists <ol>…</ol> & <li>…</li> Default is #’s change type: <ol type=“A”> “a”, “I”, “i” Definition Lists <dl>…</dl> & <dt>…</dt> & <dd>…</dd> Note: Changing type and start value not supported in “strict” versions of XHTML

28 HTML Inline Elements Line Breaks <br /> Semantic inline text elements Describes the meaning of the text Examples: <em>for emphasis, <strong> strongly emphasized, <q> short inline quote Presentational inline text elements provides descriptions of the elements style Examples: <b> keywords or visually emphasized text (bold) Ex: product name, <i> Alternative voice (italics) Ex: phrase, technical term, thought (please use: <strong> & <em> instead)

29 HTML Special Characters Must use numeric or named character reference
Examples Character space ( ) & Ampersand (&) © Copyright symbol (©) Euro (€)

30 Meaningful Markup Semantic Markup
Semantic Markup uses tags or elements that describe the content by its function. Adds meaning for the machine Browsers, mobile devices, screen readers, search engines can not “see” the page… they extract meaning and context from the markup.

31 Meaningful Markup – No Presentation Info
<h1>This is the most important headline</h1> <p>This is ordinary paragraph text within the body of the document, where certain words and phrases may be <em>emphasized</em> to mark them as <strong>particularly important</strong>.</p> <h2>This is a headline of secondary importance to the headline above</h2> <p>Any time you list related things, the items should be marked up in the form of a list:</p> <ul> <li>A list signals that a group of items are conceptually related to each other</li> <li>Lists may be ordered (numbered or alphabetic) or unordered (bulleted items)</li> <li>Lists may also be menus or lists of links for navigation </li> <li>Cascading Style Sheets can make lists look many different ways</li> </ul> Browsers, mobile devices, screen readers, search engines can not “see” the page… they extract meaning and context from the markup. The Site Development Process

32 HTML Images img tag <img> Required attribute: src
<img src=“uwm_logo.gif” alt=“UWM Logo” />

33 HYPERTEXT – it’s a web… things are linked…

34 HTML Links The anchor <a>…</a> Required attribute: href
<a href= Link to UWM </a> <a href= src=“uwm_logo.gif”/>UWM</a>

35 6,100 Files 250 Folders Site Directory and File Structure
Often mirrors visible site structure Logical naming conventions – plain language Creates useful/understandable URLs 6,100 Files 250 Folders

36 Hypertext – Absolute & Relative Links
Absolute Links <a href=“ UW-Milwaukee </a> also called an external link Relative Links <a href=“admissions.html”> Link to admissions page </a> Relative links do not require the protocol and domain name These links are “related” to the current page (The page you want to link to is within the same domain as the document you are linking from)

37 <a href=“index.html”> HOME </a>
If you were working on your about.html document and you wanted to create a link to your index.html document, your link would look like this: <a href=“index.html”> HOME </a>

38 <a href=“academics/advising.html”> Advising</a>
If you were working on your index.html document and you wanted to create a link to your advising.html document, your link would look like this: <a href=“academics/advising.html”> Advising</a>

39 <a href=“academics/graduate/comps.html”> Comps </a>
If you were working on your root level (main) index.html document and you wanted to create a link to your comps.html document, you link would look like this: <a href=“academics/graduate/comps.html”> Comps </a>

40 Index?? Significance of “index”
Usually the default filename a browser will look for if no filename is provide. retrieving a file called “index.html” in the Spring_2012 folder

41 <a href=“../advising.html”> Advising</a>
If you were working on your mlis.html document and you wanted to create a link to your advising.html document, your link would look like this: <a href=“../advising.html”> Advising</a>

42 <a href=“../../index.html”>Back to Home</a>

43 CSS – Presentation of Information

44 Meaningful Markup – No Presentation Info
<h1>This is the most important headline</h1> <p>This is ordinary paragraph text within the body of the document, where certain words and phrases may be <em>emphasized</em> to mark them as <strong>particularly important</strong>.</p> <h2>This is a headline of secondary importance to the headline above</h2> <p>Any time you list related things, the items should be marked up in the form of a list:</p> <ul> <li>A list signals that a group of items are conceptually related to each other</li> <li>Lists may be ordered (numbered or alphabetic) or unordered (bulleted items)</li> <li>Lists may also be menus or lists of links for navigation </li> <li>Cascading Style Sheets can make lists look many different ways</li> </ul> Browsers, mobile devices, screen readers, search engines can not “see” the page… they extract meaning and context from the markup. The Site Development Process

45 Presentation handled by CSS
CSS – Cascading Style Sheets A style-sheet language developed to control the presentation of HTML documents Allows for the separates the presentation (formatting) from the structure and content of the page. Structure = the content (headings, lists, paragraphs) Presentation = how the structure looks visually in the user agent (red, bold, verdana) CSS – used to format the presentation of the content fonts, colors, layout

46 Benefits of CSS Offers more control
One CSS file can control thousands of pages (more efficient) More control over formatting Precise formatting: Line spacing, type sizes, rollovers, layout Modular design - same site content and structure can be style for different output devices Media types: Screen(browsers), mobile devices, print, screen reader Smaller files / Faster download No redundant formatting tags

47 Example of CSS Separate language with its own syntax
Selectors: Selects the element to be affected Declaration: “declares” a style for a selected element Declaration block: property & value

48 Example of CSS Declaration block Selector – example
Property: identifies what to change Value: how to change it Selector – example h1{ font-size: small; font-family: Georgia, ‘Times New Roman’, Times, serif; color: #CC3300; margin-top: 4em; margin-bottom: 10em; }

49 CSS for layout Examples


Download ppt "HTML – Introduction to the Code"

Similar presentations


Ads by Google