Updates:
1.Made it for JUST XHTML
2.Differences from HTML section
3.XHTML1.1 and 1.0
Welcome to my basic XHTML tutorial.
---DIFFERENCES FROM HTML---
The document must be well formed:
-You can't have overlapping tags, for example:
Tags must be all lower-case:
-Tags are now case-sensitive
Tags must be closed:
-You must close all your tags
For tags with no ending tag, use />: *edit* now it is good
Attribute values must be in quotes:
This is just a short list.
For a full list, go to: http://www.w3.org/TR/xhtml1/#diffs
---MAKING THE PAGE---
First, you need webspace. If you don't have any, go to www.free-webhosting.com. If you want a pay host, I suggest www.dreamhost.com
If you already have webspace, we are ready to start.
--The doctype--
A doctype specifies what type of XHTML the page is using.
Here is the XHTML 1.1 doctype:
Here is the XHTML 1.0 doctype:
The doctype is the first thing you put in your file(unless there is PHP involved). I suggest using the XHTML 1.1
--Whats next--
Well, after you have the doctype in, you need to put an html tag in there.
Here is what the code should look like for XHTML 1.1:
<html xmlns="http://www.w3.org/1999/xhtml">
Here is what the code should look like for XHTML 1.0:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
After the html tag, you need a head tag. Put <head> under <html>. Next, you need to title your page.
Here is an example of title in XHTML 1.1:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My uber site</title>
XHTML 1.0:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My uber site</title>
Notice how I close the tags. If don't close tags, the won't work properly.
--Adding CSS--
CSS is what makes the page colorful. It also make the page layout. There are a few ways to use CSS.
One way is use the link tag. Here is the code:
Put that after the title tag. That code is for external style sheets. Notice how there is no </link> tag. That is because there is no finishing tag. When a tag has no finishing tag, use /> at the end.
Here is the code for internal style sheets:
body { background-color: #FFFFFF }
</style>
Internal stylesheets also go under the title.
--The finished head code--
Here is what the finished head code should look like(you can customize it anyway you want^_^!)
XHTML 1.1:
<html>
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
XHTML 1.0:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
**NOTICE** You can use either the internal or external stylesheet. I cover CSS later in the tutorial.
--That's cool and all, but noting is showing up on my site--
Patience. You still need to add more tags.
The body tag is used for all the content on your site. For example:
XHTML 1.1:
<html>
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<p>Here is a paragraph. <b>Some text</b> is bold. <u>Underline'd</u>. <i>I love italics!</i></p>
</body>
</html>
XHTML 1.0:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<p>Here is a paragraph. <b>Some text</b> is bold. <u>Underline'd</u>. <i>I love italics!</i></p>
</body>
</html>
**Some notes** Use the <p> tag whenever you use text. As you can see, <b> is bold, <u> is underline, and <i> is italics.
---CSS---
Here is a code for what you can have in css.css:
body { background-color: #FFFFFF; color: #000000 }
p.text { background-color: #000000; color: #FFFFFF }
**Some Notes** #000000 is black, #FFFFFF is white
Now here is the code in XHTML 1.1:
<html>
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<p class="text">Text omg</p>
</body>
</html>
XHTML 1.0:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<p class="text">Text omg</p>
</body>
</html>
--Layout--
Now that website example is just a black line with text. Not really a layout.
Here is an example of a layout: http://infinity-stuff.com
It uses a sidebar, and well, its organized.
-CSS-
Here is a css code for a layout:
h3, div, ul { background-color: #303030; font-family: Vernada, Arial; margin: 0px; color: #FFFFFF; padding: 0px; }
h3 { margin: 0px; padding: 0px; background: #330099; }
#content { float: right; width: 80%; postion: absolute; }
#side { float: left; width: 20%; }
#side li {list-style: none; background: #000066; font-size: 11pt; }
a { color: #000000; }
a:hover { color: #FFFFFF }
XHTML 1.1 code:
<html>
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<div id="content">
<h3>News</h3>
Content here</div>
<div id="side">
<h3>Links</h3>
<ul>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</div>
</body>
</html>
XHTML 1.0 code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<div id="content">
<h3>News</h3>
Content here</div>
<div id="side">
<h3>Links</h3>
<ul>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</div>
</body>
</html>
**NOTICE** You can edit the content and links, maybe you could add a banner. Here is an example of the layout: http://hatgal.hostingrapid.com
---DIVS---
<div> is a common-used tag. As you can see in the above example, I use <div id="side"> along with <div id="content">
When using css with divs, #titlehere is used with id, and .titlehere is used for class.
--Borders--
Here is the css part
.nav { float: left; border-style: dashed; border-width: thin; width: 25%; }
.footer { border-style: dotted; border-width: thin; width: 100%; }
XHTML 1.1:
<html>
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<div class="content">
Look at my sweet solid border!
</div>
<div class="nav">
<a href="#">Link</a><br />
<a href="#">Link</a><br />
<a href="#">Link</a><br />
Don't you love the dash?
</div>
<div class="footer">
Copyright © Me 2005. I love this dotted border
</div>
</body>
</html>
XHTML 1.0:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My uber site</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<div class="content">
Look at my sweet solid border!
</div>
<div class="nav">
<a href="#">Link</a><br />
<a href="#">Link</a><br />
<a href="#">Link</a><br />
Don't you love the dash?
</div>
<div class="footer">
Copyright © Me 2005. I love this dotted border
</div>
</body>
</html>
---XHTML TAGS---
Here is a list of XHTML tags:
http://htmldog.com/reference/htmltags/
---CSS PROPERTIES---
Here is a list of CSS 2.1 properties:
http://htmldog.com/reference/cssproperties/
---COPYRIGHT---
This tutorial is copyright Hat 2005-2006. Thanks to HTML Dog, Kev, and w3
Any questions? Email me: zeehow.lee@gmail.com


