{"id":27,"date":"2005-10-04T21:34:09","date_gmt":"2005-10-04T21:34:09","guid":{"rendered":"http:\/\/www.eyoungwon.com\/journal\/?p=27"},"modified":"2006-10-17T02:13:03","modified_gmt":"2006-10-17T02:13:03","slug":"introduction-to-html-and-xhtml","status":"publish","type":"post","link":"https:\/\/eyoungwon.com\/journal\/introduction-to-html-and-xhtml\/","title":{"rendered":"Introduction to HTML and XHTML"},"content":{"rendered":"<p>Web Design &#8211; Introduction to HTML and XHTML<br \/>\nLast updated Sep 23, 2005.<br \/>\n<strong> HTML Files, Elements and Tags, and Document Structure<\/strong><\/p>\n<p><strong \/><br \/>\nThe Web Design guide provides a <a href=\"http:\/\/www.informit.com\/guides\/content.asp?g=webdesign&#038;seqNum=34\">background<\/a> on SGML, HTML, XHTML, and XML; it even includes a <a href=\"http:\/\/www.informit.com\/guides\/content.asp?g=webdesign&#038;seqNum=38\">quick and dirty intro to XHTML<\/a>. While all that is nice, some shouts of &#8220;Start at the beginning!&#8221; echo as someone, somewhere is new to markup languages.<br \/>\nMany excellent tutorials introduce the basics of HTML; however, they often teach deprecated markup. Deprecated means &#8220;obsolete,&#8221; but browsers still understand them\u00e2\u20ac\u201dthe concept is similar to backward compatibility. <strong>Bold<\/strong> is a common deprecated element. Instead of , standards recommend using cascading style sheets (CSS) for adding heavy emphasis on text because bold is presentational. But, let&#8217;s slow down before we stray off topic.<\/p>\n<p>This tutorial shows the recommended way to do markup while using XHTML. HTML and XHTML are similar, but XHTML has stricter rules.<\/p>\n<p>For example, with paragraph (  ), HTML isn&#8217;t picky about whether or not you include the closing whereas XHTML demands to see it. HTML is not case sensitive, which means it doesn&#8217;t matter if you use or . However, XHTML requires everything to be in lower case. So all tags use lower case.<\/p>\n<p><strong><strong><!--more--><br \/>\nHTML Files<\/strong><\/strong><\/p>\n<p><strong><strong \/><\/strong>HTML stands for HyperText Markup Language. At its most basic, a Web page is an HTML file (those of you shouting out there with PHP, ASP, or ColdFusion pages\u00e2\u20ac\u201dbear with me\u00e2\u20ac\u201dwe&#8217;re talking HTML today) with markup tags. These tags give the browser direction on how to display the page and its content. An HTML file uses the .htm or .html extension.<\/p>\n<p><strong><strong><br \/>\n<\/strong><\/strong> To create an HTML page, all you need is a text editor like Notepad, WordPad, or SimpleText for those on a Mac. You can find other freeware or general public license (GPL or GNU GPL) text editors on the Internet by doing a search for &#8220;free text editors.&#8221; GPL, or GNU GPL, is free license software, which is also known as open source software. You can find many of these at<strong><strong> <a target=\"_blank\" href=\"http:\/\/www.sourceforge.net\/\">Sourceforge<\/a>.<\/strong><\/strong><\/p>\n<p><strong><strong><br \/>\n<\/strong><\/strong> If you have a WYSIWYG (What You See Is What You Get) editor\u00e2\u20ac\u201dan application that displays the contents of a page almost exactly as you would see it in a browser or on a printout\u00e2\u20ac\u201dsuch as FrontPage, Dreamweaver, or GoLive, I recommend starting with a text editor anyway. It&#8217;s an excellent learning tool and it helps you in working with these WYSIWYG applications.<strong><strong> <\/strong><\/strong><br \/>\nWhat about Microsoft Word? Well, you can use it as long as you save each file as text. Microsoft Word has the ability to enter its own code, which tends to cause problems in an HTML file.  Fire up your text editor, save a new file as example.html\u00e2\u20ac\u201dyou can name the file whatever you&#8217;d like as long as it ends with .htm or .html\u00e2\u20ac\u201dand enter the examples we cover in this article. Save often. Some text editors might add .txt at the end of the file name. If this happens, you can rename the file to remove it by right-clicking on the file, selecting rename, and removing .txt.<\/p>\n<p><strong><strong><br \/>\n<\/strong><\/strong> Since you already have a browser (as that&#8217;s how you&#8217;re viewing this page), your computer most likely knows what to do when you double-click on an .htm or .html file, which is to open it in your browser. Alternatively, you can open your browser, select File > Open File, browse the file window until you find your file, select the file, and click Open.<\/p>\n<p><strong><strong><br \/>\n<\/strong><\/strong> You can also open an .htm or .html file in your text editor by locating the file through the File > Open command or right-clicking on the file name, selecting Open With&#8230;, and choosing NotePad. If you do not see Open With, click Open instead.<\/p>\n<p><strong><strong><br \/>\nElements and Tags<\/strong><\/strong><\/p>\n<p><strong><strong \/><\/strong>I promise, no chemistry lesson here\u00e2\u20ac\u201dwe&#8217;re talking about elements with two tags, text, and sometimes other elements. Nothing liquid or hazardous. Tags are closed in with the angle brackets, which use the less than (<) and greater than (>) symbols. Element content appears between the start tag and end tag. Reading markup is like reading English, from left to right, and top to bottom. The following is an example of a heading:<strong><strong> <\/strong><\/strong><\/p>\n<h1><strong><strong>Web Site Name<\/strong><\/strong><\/h1>\n<p><strong><strong><br \/>\n<\/strong><\/strong><\/p>\n<h1><strong><strong>is the start tag while <\/strong><\/strong><\/h1>\n<p>is the end tag. The start tag indicates to apply the element from this point forward and the end tag tells the browser when to stop applying the element. The element in the example consists of heading 1 along with the tags and the content. Let&#8217;s expand the page to include the page name for the content:<strong><strong> <\/strong><\/strong><\/p>\n<h1><strong><strong>Web Site Name<\/strong><\/strong><\/h1>\n<p><strong><strong><br \/>\n<\/strong><\/strong><\/p>\n<h2><strong><strong>Title of the Page<\/strong><\/strong><\/h2>\n<p><strong><strong><br \/>\nNotice we don&#8217;t use <\/strong><\/strong><\/p>\n<h3><strong><strong>instead of <\/strong><\/strong><\/h3>\n<h1><strong><strong>or <\/strong><\/strong><\/h1>\n<h2>. It wouldn&#8217;t be logical. Some people do this because they want the text to appear smaller than the default style for<\/h2>\n<h1>and<\/h1>\n<h2>. The heading&#8217;s job is to identify the text and its place within the document&#8217;s pecking order, or hierarchy. Presentational markup will take care of how it looks. Also note that we use lower case &#8216;h&#8217; instead of &#8216;H&#8217;. XHTML requires this and HTML doesn&#8217;t care either way.<br \/>\nRequired Tags<br \/>\nEvery .html file should have the following tags:<br \/>\nandand<br \/>\nand<br \/>\nappears at the beginning, telling the browser this is the start of an HTML document. appears at the end of the file telling the browser the HTML document ends here.<br \/>\nContent appearing between and includes the header information such as is what goes at the top of the browser&#8217;s window. This usually has the name of the Web site, the Web page, or related information.<br \/>\nAfter comes , which includes the bulk of the content. goes at the end of the file prior to (nothing should be between these two closing tags.). Let&#8217;s create a basic document with these tags, so you don&#8217;t have to enter them every time. Put the following in a new text page:<\/p>\n<p>content<\/p>\n<p>Save the file as starter.html. Whenever you need to start a new page, just open starter.html, save the file with SAVE AS, and give it a new name (example.html will do fine) before you do anything else. This ensures you don&#8217;t overwrite your starter page.<br \/>\nStructure the Document (English: Make the Document Readable)<br \/>\nYou may have heard variations of &#8220;separate presentation and content&#8221; or &#8220;separate style and structure.&#8221; Content or structure refers to the text itself\u00e2\u20ac\u201dnot what color it is or what it looks like. Presentation and content do, however, need each other. While you could leave out presentation or style tags, the resulting document would resemble a page from the Internet&#8217;s early days\u00e2\u20ac\u201da long white document with a few bold headers here and there. No columns. Nothing to make it look pretty.<br \/>\nStructural elements define the purpose of the text. All of these, of course, have end tags such as<strong><strong> <\/strong><\/strong><\/h2>\n<p><strong><strong>or . These include: headings &#8211; <\/strong><\/strong><\/p>\n<h1><strong><strong>, <\/strong><\/strong><\/h1>\n<h2><strong><strong>, <\/strong><\/strong><\/h2>\n<h3><strong><strong>, <\/strong><\/strong><\/h3>\n<h4><strong><strong>, <\/strong><\/strong><\/h4>\n<h5><strong><strong>, and <\/strong><\/strong><\/h5>\n<h6><strong><strong><br \/>\nparagraphs &#8211; <\/strong><\/strong><strong><strong><br \/>\nlist items &#8211; <\/strong><\/strong><\/p>\n<li><strong><strong><br \/>\nquotes &#8211; <\/strong><\/strong><\/p>\n<blockquote><p><strong><strong><br \/>\nFor example, the following has no elements, so it appears exactly as you see it here.<br \/>\nTitle of Document Nulla facilisi. Aliquam adipiscing, libero in mollis eleifend, ipsum pede laoreet metus, sed consectetuer ante dolor eget nunc. Vestibulum in pede. Nam mi. Nulla facilisi. Aliquam adipiscing, libero in mollis eleifend, ipsum pede laoreet metus, sed consectetuer ante dolor eget nunc. Vestibulum in pede. 1. Nam mi. 2. Aenean metus felis. 3. ultrices quis 4. ornare in. Proin mollis. Etiam augue sem, lacinia sed, porttitor eget, fermentum at, tortor. Vestibulum fringilla. Vestibulum consequat nisl.<br \/>\nThat&#8217;s hard to read, isn&#8217;t it? This resembles a long email without paragraph breaks. How about adding a header, paragraph, and list items? That should make it readable like the following content. Feel free to copy this in your example.html file between the and tags. <\/strong><\/strong><\/p>\n<h1><strong><strong>Title of Document<\/strong><\/strong><\/h1>\n<h2><strong><strong>This is heading 2<\/strong><\/strong><\/h2>\n<h3><strong><strong>This is heading 3<\/strong><\/strong><\/h3>\n<h4><strong><strong>This is heading 4<\/strong><\/strong><\/h4>\n<h5><strong><strong>This is heading 5<\/strong><\/strong><\/h5>\n<h6><strong><strong>This is heading 6<\/strong><\/strong><\/h6>\n<p><strong><strong>Nulla facilisi. Aliquam adipiscing, libero in mollis eleifend, ipsum pede laoreet metus, sed consectetuer ante dolor eget nunc. Vestibulum in pede. Nam mi. Nulla facilisi. Aliquam adipiscing, libero in mollis eleifend, ipsum pede laoreet metus, sed consectetuer ante dolor eget nunc. Vestibulum in pede.<\/strong><\/strong><\/p>\n<p><strong><strong><br \/>\n<\/strong><\/strong><strong><strong>Proin mollis. Etiam augue sem, lacinia sed, porttitor eget, fermentum at, tortor. Vestibulum fringilla. Vestibulum consequat nisl.<\/strong><\/strong><\/p>\n<p><strong><strong><br \/>\nThough it&#8217;s not in English, it&#8217;s easier on the eyes. What if you need the name of the Web site, title of the page, and two headers followed by paragraphs? Before looking at the markup below, see if you can do it. Hint: use <\/strong><\/strong><\/p>\n<h1><strong><strong>, <\/strong><\/strong><\/h1>\n<h2><strong><strong>, <\/strong><\/strong><\/h2>\n<h3><strong><strong>, and <\/strong><\/strong><strong><strong>. Remember to use the end tag. <\/strong><\/strong><\/h3>\n<h1><strong><strong>InformIT<\/strong><\/strong><\/h1>\n<h2><strong><strong>Reference Guides<\/strong><\/strong><\/h2>\n<h3><strong><strong>Web Design Guide<\/strong><\/strong><\/h3>\n<p><strong><strong><br \/>\n<\/strong><\/strong><strong><strong>Welcome to the InformIT.com Web Design Reference Guide. You may have seen other reference guides, for example, Flash and Photoshop. Flash and Photoshop certainly play a role in Web design, but unlike those topics, this guide provides a snapshot of everything Web design. The information in this guide includes reference, news, and access to the Web design community.<\/strong><\/strong><\/p>\n<h3><strong><strong>Photoshop Guide<\/strong><\/strong><\/h3>\n<p><strong><strong>Unless you accidentally stumbled here, you probably know what Photoshop is and you want to learn more or look for a solution to a nagging problem.<\/strong><\/strong><\/p>\n<p><strong><strong>Try viewing the file in a browser by double-clicking on the file name or opening it from within the browser. This is how it appears in a browser:<\/strong><\/strong><\/p>\n<p><strong><strong><a href=\"javascript:bluecoat_allow_popup=true;popUp%28\">Figure 1<\/a><br \/>\nHow did your results turn out? For practice, try creating a Web site for your friends or family using the elements we covered in this section. Also, throw in a <\/strong><\/strong><\/p>\n<h4><strong><strong>and <\/strong><\/strong><\/h4>\n<h5><strong><strong>and their end tags to see how they compare to the others.<br \/>\nAnother great learning tool is studying the Web sites of others by viewing their source codes. To view, do the following:<br \/>\nClick View<br \/>\nClick Source (In Firefox, it&#8217;s Page Source)<br \/>\nThat&#8217;s it. You may not recognize all of the markup or the added code. No worries. It&#8217;ll get easier as you do more HTML work. In no time, you&#8217;ll be writing nice, clean XHTML-acceptable markup.<\/strong><\/strong><strong><strong> <\/strong><\/strong><\/h5>\n<\/blockquote>\n<\/li>\n<\/h6>\n","protected":false},"excerpt":{"rendered":"<p>Web Design &#8211; Introduction to HTML and XHTML Last updated Sep 23, 2005. HTML Files, Elements and Tags, and Document Structure The Web Design guide provides a background on SGML, HTML, XHTML, and XML; it even includes a quick and dirty intro to XHTML. While all that is nice, some shouts of &#8220;Start at the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-web-development"],"_links":{"self":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":0,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"wp:attachment":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}