<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Jhon Adams' Notes</title>
	<atom:link href="http://blog.jhonadams.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jhonadams.net</link>
	<description>A collection of ramblings</description>
	<pubDate>Sun, 13 Jul 2008 21:08:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>An Introduction to XHTML and CSS, Part II</title>
		<link>http://blog.jhonadams.net/2008/07/13/an-introduction-to-xhtml-and-css-part-ii/</link>
		<comments>http://blog.jhonadams.net/2008/07/13/an-introduction-to-xhtml-and-css-part-ii/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 21:08:13 +0000</pubDate>
		<dc:creator>Jhon Adams</dc:creator>
		
		<category><![CDATA[XHTML tutorial]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.jhonadams.net/?p=8</guid>
		<description><![CDATA[While the last article was mainly about XML, in this article you&#8217;ll actually learn the basics to creating a webpage.
I noted very briefly last time that XHTML has three different flavors, Basic, Transitional and Strict. The only flavor we are going to talk about is XHTML Strict. The Strict specification is designed to totally separate [...]]]></description>
			<content:encoded><![CDATA[<p>While the last article was mainly about XML, in this article you&#8217;ll actually learn the basics to creating a webpage.</p>
<p>I noted very briefly last time that XHTML has three different flavors, Basic, Transitional and Strict. The only flavor we are going to talk about is XHTML Strict. The Strict specification is designed to totally separate the content from the design. This allows the design to be completely interchangable through &#8220;Cascading Style Sheets&#8221; (or CSS) without needing to reload the page. This also allows the webpage to provide different style sheets for printing than are used in the browser.</p>
<p>The first step toward creating a web page is to include the XML specification from the last article. This is not required by the XHTML specification, but it is not a bad idea. The second thing is the document type. This tells the web browser what flavor you&#8217;re going to be using. If you break from the document type the browser may enter a mode where instead of displaying what it has been told to display, it will attempt to display its best guess. In this case we&#8217;ll be saying that we are using the &#8220;XHTML 1.0 Strict&#8221; specification.</p>
<p><span id="more-8"></span></p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</pre>
<p>Now that we have document type in there, the rest of the document is going to be exactly like the XML we did before. Instead of having a &lt;pets&gt; tag though, we&#8217;re going to be using an &lt;html&gt; tag. The html tag should have a few attributes. The first one is an &#8220;xmlns&#8221; attribute (short for XML Namespace). This seems sort of redundant, but it tells the browser that all the HTML contained between the html tags are actually XHTML. The second two attributes are to let the browser know both what language the html is in and what language the content is in. After adding the html tag (and closing tag) our document will look like:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;/html&gt;
</pre>
<p>We&#8217;re well on our way to creating our webpage, but there are still a few items that are required by the XHTML strict specification to have a webpage! The first is a head tag. The head tag will contain information about the webpage that isn&#8217;t part of the actual content. This includes things like the title and the style information. The second part is the body tag which contains the actual content that is displayed in the browser. The head tag requires a title and the body tag isn&#8217;t worth it&#8217;s salt unless there&#8217;s something in it so we&#8217;ll add those items too. Which leads us to:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
	&lt;head&gt;
		&lt;title&gt;Tutorial 2a&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;p&gt;Hello, World.&lt;/p&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The &lt;p&gt; tag is one that I never explained, but it is very simple. It is a paragraph tag. The text in between the &lt;p&gt; and &lt;/p&gt; tag are considered to be complete paragraphs and will be separated from the rest of the text. If you simply hit enter a couple times between paragraphs, the browser will mash all your paragraphs into one big block of text. Now take this code and place it into a text document, saving it with the extension &#8220;html&#8221;. If you open this file in a web browser you should get something that looks like <a title="Tutorial 2a" href="http://www.jhonadams.net/xhtmlTutorial/part2/tut2a.html">this</a>.</p>
<p>A fantastic start to a webpage, but normally you will have more than one webpage, so we need to be able to connect them. For this we use an anchor tag. The tag itself uses only the letter &#8220;a&#8221; and has an &#8220;href&#8221; attribute to specify where the link goes to. In this case, we&#8217;re going to link to our previous page, so we can use a &#8220;relative href&#8221;. This means that we really only need the page name. If you wanted to link to http://www.example.com, you would have to enter the whole URL including the http://. We&#8217;ll save this as a separate file.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
	&lt;head&gt;
		&lt;title&gt;Tutorial 2b&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;p&gt;Where is the &lt;a href='tut2a.html'&gt;World&lt;/a&gt;?&lt;/p&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>This page can be seen <a title="Tutorial 2b" href="http://www.jhonadams.net/xhtmlTutorial/part2/tut2b.html">here</a>. As you can see, by clicking the linke we are taken back to the last page. If this is not working for you, make sure your new page is saved to the same directory and the href has the name of your last file in it.</p>
<p>The last two things that will be covered in this article are images and headings. There are 6 kinds of headings that you can use, h1 being the largest, h6 being the smallest and the rest falling somewhere in between. Today, we&#8217;re just going to use h1. We use it just like any other tag, by putting the text we want as a heading in the middle of it.</p>
<p>The image tag is more complex. It is abbreviated as img and does not have an end tag, instead it requires several attributes. The first is the image&#8217;s source, where the image comes from. The second and only other required is the alternate text. This attribute is abbreviated as &#8220;alt&#8221; and is used when the image cannot be displayed (or if the image needs to be read aloud). Another attribute that is often used is the title text, this is the text that is displayed when you move your mouse over the image. In this case we&#8217;re going to use an image hosted by the World Wide Web Consortium which says that our page is 100% XHTML compliant.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
	&lt;head&gt;
		&lt;title&gt;Tutorial 2c&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;h1&gt;Perhaps we need a title?&lt;/h1&gt;
		&lt;p&gt;Then there should be some text that goes here to entertain us ^_^&lt;/p&gt;
		&lt;p&gt;
			&lt;a href="http://validator.w3.org/check?uri=referer"&gt;
				&lt;img src="http://www.w3.org/Icons/valid-xhtml10-blue"
					alt="Valid XHTML 1.0 Strict"
					title="Valid XHTML 1.0 Strict" /&gt;
			&lt;/a&gt;
		&lt;/p&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The completed page is located <a title="Tutorial 2c" href="http://www.jhonadams.net/xhtmlTutorial/part2/tut2c.html">here</a>. Tomorrow I&#8217;ll cover using CSS to style the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jhonadams.net/2008/07/13/an-introduction-to-xhtml-and-css-part-ii/feed/</wfw:commentRss>
		</item>
		<item>
		<title>An Introduction to XHTML and CSS, Part I</title>
		<link>http://blog.jhonadams.net/2008/07/12/an-introduction-to-xhtml-and-css-part-i/</link>
		<comments>http://blog.jhonadams.net/2008/07/12/an-introduction-to-xhtml-and-css-part-i/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 18:38:56 +0000</pubDate>
		<dc:creator>Jhon Adams</dc:creator>
		
		<category><![CDATA[XHTML tutorial]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[xhtml]]></category>

		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.jhonadams.net/?p=7</guid>
		<description><![CDATA[After I recommended that a friend of mine look into Web Design as a way to put her artistic skills to use, I realized that I can at start my blog rolling by writing a tutorial on XHTML and CSS. The main concept behind this part of the tutorial is to familiarize you with the [...]]]></description>
			<content:encoded><![CDATA[<p>After I recommended that a friend of mine look into Web Design as a way to put her artistic skills to use, I realized that I can at start my blog rolling by writing a tutorial on XHTML and CSS. The main concept behind this part of the tutorial is to familiarize you with the basics of the structure of XHTML and introduce some concepts to play with.</p>
<p>XHTML has 3 different &#8220;flavors&#8221;. XHTML Basic, XHTML Transitional, and XHTML Strict.</p>
<p>XHTML is built ontop of a language called XML. XML consists of opening and closing &#8220;tags&#8221; that are used to describe content. For instance, if you wanted to describe your pets you could do it in XML:</p>
<p><span id="more-7"></span></p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;pets&gt;
	&lt;cat&gt;
		&lt;name&gt;Moonlight&lt;/name&gt;
		&lt;age&gt;10&lt;/age&gt;
		&lt;color&gt;Black and Grey&lt;/color&gt;
	&lt;/cat&gt;
	&lt;dog&gt;
		&lt;name&gt;Sparky&lt;/name&gt;
		&lt;age&gt;6&lt;/age&gt;
		&lt;color&gt;Reddish Orange&lt;/color&gt;
	&lt;/dog&gt;
&lt;/pets&gt;</pre>
<p>The first line of XML tells whatever is reading this document, whether it is human or machine, that the document is going to conform to the standards of XML version 1.0, and the character encoding used in the document is UTF-8. The character encoding is the way the the computer represents each letter as 1&#8217;s and 0&#8217;s. Today, the most common encoding is UTF-8.</p>
<p>The next portion of this XML document is the pets tag. By using the pets tag, we tell the reader that the information contained within this document (or rather, between &lt;pets&gt; and &lt;/pets&gt;) is information about pets. By the same token, the cat tag tells the reader that the information contained within &lt;cat&gt; and &lt;/cat&gt; is information about a cat and the information between &lt;name&gt; and &lt;/name&gt; is information about a name.</p>
<p>In addition to tags, XML documents can also contain attributes. Attributes get stuffed into the tags to supply even more information. For instance, saying all the pets belong to Jhon is going to be difficult with what we&#8217;ve learned so far. We could stuff an &lt;owner&gt; tag into everything, but what if I&#8217;ve named everyone of my 300 goldfish? That&#8217;s a huge number of additional tags! Instead we can add an attribute to our pets tag, making it read:</p>
<pre>&lt;pets owner="Jhon"&gt;</pre>
<p>In a similar way, we can cram most of our previous file into 5 glorious lines by using:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;pets owner="Jhon"&gt;
	&lt;cat name="Moonlight" age="10" color="Black and Grey"&gt;&lt;/cat&gt;
	&lt;dog name="Sparky" age="6" color="Reddish Orange"&gt;&lt;/cat&gt;
&lt;/pets&gt;</pre>
<p>There is one more thing that can be done to simplify it one step further. In XML, if a tag contains no tags (e.g. &lt;cat&gt;&lt;/cat&gt;) we can combine the two tags into one by using &lt;cat /&gt;. Therefore our file becomes:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;pets owner="Jhon"&gt;
	&lt;cat name="Moonlight" age="10" color="Black and Grey" /&gt;
	&lt;dog name="Sparky" age="6" color="Reddish Orange" /&gt;
&lt;/pets&gt;</pre>
<p>While we could cram the cat and the dog attributes into the pets tag but concocting some sort of patter that separates the attributes by commas, this defeats the purpose of XML. Anything that can be pluralized should remain inside it&#8217;s own tag. We can see above that the colors are listed as a list so should probably have their own tags. This has the added benefit that we can add attributes to the colors themselves.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;pets owner="Jhon"&gt;
	&lt;cat name="Moonlight" age="10"&gt;
		&lt;color where="back"&gt;Black&lt;/color&gt;
		&lt;color where="belly"&gt;Grey&lt;/color&gt;
	&lt;/cat&gt;
	&lt;dog name="Sparky" age="6"&gt;
		&lt;color where="back"&gt;Reddish Orange&lt;/color&gt;
		&lt;color where="belly"&gt;Cream&lt;/color&gt;
	&lt;/dog&gt;
&lt;/pets&gt;</pre>
<p>This has the effect of creating a longer document, but we have more data than before and it is easier to read. There&#8217;s no real good way to tell when you should be using an attribute and when you should be using a tag, different people have different ways of writing it.</p>
<p>While none of this document actually covers writing a webpage, it provides a good introduction to the underlying language. XHTML is a specific set of rules for using XML in the description of webpages and CSS is how you display it. Tomorrow (or later today) I&#8217;ll cover writing a hello world page.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jhonadams.net/2008/07/12/an-introduction-to-xhtml-and-css-part-i/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
