1 / 95

HTML 101

HTML 101. HTML. HTML is a standard Maintained by a nonprofit, international organization participated by many IT companies W3.org. HTML. Simple Just markups and plaintext Readable by human Use plain text Editable by Notepad Verbose Readable and friendly to human

judd
Download Presentation

HTML 101

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HTML 101

  2. HTML • HTML is a standard • Maintained by a • nonprofit, • international organization • participated by many IT companies • W3.org

  3. HTML • Simple • Just markups and plaintext • Readable by human • Use plain text • Editable by Notepad • Verbose • Readable and friendly to human • Leave the chore to computer • Good!!!

  4. HTML Versions • Now comes HTML 4.0 and XHTML • Strict syntax as XML • Lowercase tags • About content, not format, which is designated to css • HTML 5.0 • Canvas • …

  5. The file extension • .html • .htm

  6. Editable by • Notepad • dreamWeaver • Visual Studio • … • Browsable by • Ie • Opera • Chrone • …

  7. You will learn • Syntax • Editor • Tags/Atributes

  8. HTML Syntax

  9. HTML文档基本结构 <html> <head> <!—Here goes the info about the document--> </head> <body> <!—Here goes the content--> </body> </html>

  10. HTML Tag Basics Start tag End tag <h1>Hello World</h1> Tags “mark up” the HTML document. The tags are read and interpreted by the browser - but not shown. Attribute <img src=”x.gif” /> A self closing tag does not need a corresponding end tag. Self-closing tag

  11. ML--Element • The start tag and end tag must be paired; note the slash • There are elements /texts between the start tag and end tag

  12. ML--Element • We have rules regarding the element name and what content it holds • You must use specified element name and cannot create your own element • The element name is lowercase, generally

  13. ML--Element • For element with no content, the start tag and end tag are collapsed into one like <hr/>. • hr means horizontal row, a horizontal line.

  14. Attributes • <html> • <head> • <title>Untitled Page</title> • </head> • <body> • 姓名: • <input type="text" /> • 婚否 • <input type="checkbox" checked/> • </body> • </html> • Separated by at least one whitespace • Value must be quoted by double quotes • A property can have no value • Same Property name doesn’t occur twice • Attribute identifier contains no special chars such as =,”, etc.

  15. HTML标记 lower case • Tag/ Attribute • 一般小写

  16. ML--Content • <html> • <head> • <title>Untitled Page</title> • </head> • <body> • 姓名: • <input type="text" /> • 婚否 • <input type="checkbox" checked/> • </body> • </html> • In the starting note and ending note is the content, including other tags and/or plain texts

  17. ML--Content • <html> • <head> • <title>Untitled Page</title> • </head> • <body> • 姓 名 : • <input type="text" /> • 婚 • 否 • <input type="checkbox" checked/> • </body> • </html> Redundant space and carriage enter are ignored • Note the space before, in and after “姓 名:” • Note the newline in “婚否”is displayed as whitespace • If you want to insert some whitespace, or other special chars, such >, you have to…see next slide

  18. Escape Special Chars

  19. Escape Special chars • &Aring; vs &aring; • Entity name ,case sensitive • &#65; &#1234;&#229; • Entity number ,decimal • &#xe5 • Entity number, hexadecimal, case insensitive <html> <head> <title>Untitled Page</title> </head> <body> 姓名: <input type="text" /> 婚否? <input type="checkbox" checked/> <br /> 请朗读以下字符:&Aring;&aring;&#65;&#1234;&#229;&#Xe5;&#xE5; &amp;&lt;&gt;&quot;&nbsp; </body> </html>

  20. How to display a world map with only one character <html> <body> <p style="font-family:Webdings;font-size:600px;">&#0251;</p> </body> </html>

  21. Edit HTML

  22. Good habit to code ML-Indent • Start and end at the same indent position • Content needs a unit of indent. • Use tab <tag> <subTag1>…</subtag1> <subTag2> … </subTag2> </tg> Help you debug

  23. ML Coding—outline first • Write the outlying pair (tags, quotes, braces, etc) first, then insert its content. E.g • <tag></tag> • <tag>””</tag> • <tag> • “…” • <subTag> • </subTag • </tag> • Make the code syntactically right always • Help debug • Lest that the latter part be forgotten

  24. tools • Notepad • Visual Studio • DreamWeaver • Word, excel, … • …

  25. debug • FireBug • Browser • Press F12 in new versions of IE

  26. Validating HTML • To validate a web page, you can use the online validator • Paste, or upload the HTML or use a URL • http://validator.w3.org Source: W3C http://validator.w3.org/check

  27. HTML Tags

  28. Comment • <!--comment inserts here--> • If you want to delete some contents temporally, you can comment it out. • <html> • <head> • <!--<title>Hi, HTML</title>--> • </head> • </html>

  29. HTML常用标记 inhead <title> <meta> <meta name="keywords" content="HTML, CSS, XML" /> <meta name="description" content="Free Web tutorials on HTML, CSS, XML" />

  30. HTML常用标记 inhead • <title> • HTML, CSS, XML" />

  31. meta name=“___” • <meta> • <meta name="keywords" content="HTML, CSS, XML" /> • <meta name="description" content="Free Web tutorials on HTML, CSS, XML" />

  32. Refresh by http-equiv • <meta http-equiv="Refresh" content="300"> • <meta http-equiv="Refresh" content="20; URL=page4.html">

  33. Meta name=… • Author • The value must be a free-form string giving the name of one of the page's authors.

  34. base • have either an href attribute, a target attribute, or both, specifying • the document base URL for the purposes of resolving relative URLs, • the name of the default browsing context for the purposes of following hyperlinks. The • There must be no more than one base element per document.

  35. <head> • <base href="http://www.example.com/news/index.html"> • </head> • <body> • <a href="archives.html">archives</a> would be a link to http://www.example.com/news/archives.html. • </body>

  36. Link • <link rel="stylesheet" href="B" type="text/css"> • <link rel="stylesheet" href="C">

  37. HTML常用标记 inbody <h1>… <h6> <div> <span><p> <hr><br> <img> <object><iframe> <a> <!– 注释内容 --> <table><form> 

  38. <article> • <section>

  39. Header Levels <h1>First Major Heading</h1> <h2>First Subheading</h2> <h2>Second Subheading</h2> <h3>A Sub-subheading</h3> <h1>Another Major Heading</h1> <h2>Another Subheading</h2> Headers were very ugly in default rendering - most folks started with <h3>.

  40. <p>paragraph</p>

  41. bdi

  42. bdi • The bdi element represents a span of text that is to be isolated from its surroundings for the purposes of bidirectional text formatting. [BIDI] • For the purposes of applying the bidirectional algorithm to the contents of a bdi element, user agents must treat the element as a paragraph-level container. • For the purposes of applying the bidirectional algorithm to the paragraph-level container that a bdi element finds itself within, the bdi element must be treated like a U+FFFC OBJECT REPLACEMENT CHARACTER (in the same manner that an image or other inline object is handled).

  43. Categories: • Flow content. • Phrasing content. • Palpable content. • Contexts in which this element can be used: • Where phrasing content is expected. • Content model:Phrasing content. • Content attributes: • Global attributes • Also, the dir global attribute has special semantics on this element • DOM interface:Uses HTMLElement.

  44. <ul> • <li>User <bdi>jcranmer</bdi>: 12 posts. <li>User <bdi>hober</bdi>: 5 posts. • <li>User <bdi>إيان</bdi>: 3 posts. • </ul>

  45. bdo

  46. The bdo element represents explicit text directionality formatting control for its children. It allows authors to override the Unicode bidirectional algorithm by explicitly specifying a direction override. [BIDI]

  47. bdo vs bdi

  48. bdi • unicode • bdo • Explicitly by dir

  49. ... <ruby> 汉<rt>hàn</rt> 字<rt>zì </rt> </ruby>...

More Related