What if SYS were light instead of dark?
Posted Oct 20, 06:15 PM
Section: Articles
Categories: Categories:
Comments: 0
Related Articles:
Making Reflections in Photoshop
Tutorial: Super glossy dented objects Part 2
Tutorial: Super glossy dented objects
Tutorial: Easy tiling images in Corel Painter
Tutorial: Radial Symmetry in Photoshop
Multiple Knockout Layers Video Tutorial
Form Follows Function 1: What's a web-site?
Creating gradient-faded patterns
Rasterizing and merging styled layers
Great Hosting Deal
This article will get you coding with some basic Standards-Compliant XHTML/CSS web-design by doing the following:
This article will get you coding with some basic Standards-Compliant XHTML/CSS web-design by doing the following:
Everybody has a different way of brainstorming ideas for web-designs. Some start right at the code and work up, while others sketch in notebooks or do mock-ups in DreamWeaver. Personally, I tend to start in Photoshop, sketching out an idea of how the site should look. To the left is a thumbnail of the template we’ll use as an example for this series, MorningBliss. It’s a traditional Blog/CMS design, with a spacious graphic header, fixed-width design, wide content area, and chunky side-bar for navigation links and the like. It also includes a graphical footer at the bottom of the page (not visible in preview).
Here are some of the areas or features I wanted in this Web-template:
Although one can theoretically create full-fledged HTML websites in Photoshop, the markup/coding is often sloppy and functionality minimal, at best. In old crappy table-based web-site layouts frequently the site would be made entirely in Photoshop, then chopped up or “sliced” in ImageReady to make downloading the page easier and exported for use. That’s not Standards-Compliant design, and we’re gonna do things the right way, from the code up, with the template sketch as our finished goal.
So how is a web-site structured? If we took took the desired functions mentioned above and sketched out hierarchically what is desired, something like the image to the right might result. (Using freeware programs like Freemind can be helpful when planning where things will go in a site, or even in planning site navigation.) You’ll notice that many elements of the structure are nested within others, like Russian matryoshka dolls. Take the article content element, for instance. It is contained within an article, which itself is contained in the left-column, in the main-body, in the container, of the body, of the HTML document. In this respect, the article content element is a descendant or child of all the elements it’s contained within. The elements that contain the article content element would be called ancestor elements.
You might have astutely noticed that some of the bubbles in that structure-map were highlighted with red text. These are required elements of a properly made HTML document, in this case, XHTML. We’ll get to that further on in the article, but give yourself extra-credit if you picked up on this fact!
To create an XHTML/CSS Standards-Compliant web-site, all you really need is a text-editor. REALLY!!! However, design professionals often rely on costly commercial software to provide a nice interface, reference materials, and previews of sites under construction, as well as FTP clients to publish the sites. Industry standard, of course, is Adobe’s DreamWeaver, probably the best commercial web-design product in the solar system. It’s available for Mac OS X and Windows, and although the price is certainly merited for a professional web developer or hard-core enthusiast, the price-point is intimidating for the casual learner. Another commercial alternative is Coda, a incredible and affordable program for Mac OS X. It’s a bargain at $69, compared to the $399 for DreamWeaver, and also includes built-in referencing: The Web Programmer’s Desk Reference.
Free alternatives exist, however, and generally do pretty good job. Nvu is a WYSIWYG web-design program that will let you work via drag-and-drop or by messing with the code directly. It has a more stable, unofficial sibling named KompoZer, which is also freely available on multiple OS platforms. It’s essentially a bug-fix release of Nvu. Although both are decent enough for the novice, the coding done by these programs is (IMHO) really sloppy, making maintenance or code-level modification of sites more difficult. The closest I’ve found (recommendations anyone?) to getting even close to DreamWeaver like capability for free is Quanta Plus, which is only available for *Nix systems running the KDE Desktop Environment, clearly a trade-off for Windows users.
For purposes of demonstration in this series, the examples of code I use will be done in the freeware text-editor jEdit. I know there are those out there that despise this program (right Wes?) but I’ve decided to show examples from it for a few reasons I feel important:
So, we’ve got a pretty template, got an idea of what we want in it…
…Now where do we start?
Let’s start on making some Clean Semantic Markup. This means we’re gonna code the content using the appropriate HTML tags for for appropriate items, paragraphs going into <p></p> tags, level 1 titles into <h1></h1> tags, for instance. First we’ll discuss XML tags. Then I’ll present a list of some of the common XHTML tags, the ones we’re gonna use.
Tags are just a method to annotate content. Think of a Word document in which certain text is bold, there must be something to tell Word where the boldening starts and ends. In HTML/XHTML, those things are called “TAGs”. HTML was an old standard that specified which web-tags did what. It has since been supplanted by XHTML, which is a much more strict form of HTML relying upon XML. For purposes of instruction here, XHTML looks nearly identical to HTML, and is much more cross-browser compatible. XML itself looks very similar to old HTML, but is much more versatile. Lemme give you an example.
Here is some generic data in no particular format:
People
——————————-
First name: Fred
Last name: Pestulwinkelish
Nick-name: DorkFirst name: Chester
Last name: Pestulwinkelish
Nick-name: SchmuckFirst name: Bartholomew
Last name: Turdmunch
Nick-name: Putz
Here is how the data could be stored using XML:
<people> <person> <firstname>Fred</firstname> <lastname>Pestulwinkelish</lastname> <nickname>Dork</nickname> </person> <person> <firstname>Chester</firstname> <lastname>Pestulwinkelish</lastname> <nickname>Schmuck</nickname> </person> <person> <firstname>Bartholomew</firstname> <lastname>Turdmunch</lastname> <nickname>Putz</nickname> </person> </people>
XML surrounds data with opening and closing tags, which I’ll call a Tag set, or Elements. These tags are a word surrounded by the greater-than symbol “<“ and ending with the less-than symbol “>“. The <people> tag starts a list of people, and ends with the </people> tag. Think of these like opening and closing quotation marks. The closing tag looks just like the opening tag but contains a “/” character within the brackets.
In this particular example there are a few nested tags, where one or more tag-sets are contained within another tag-set. For instance the tag-set <people>...</people> contains three more sets of tags, <person>...</person> which themselves each contain three more tag pairs, <firstname>...</firstname>, <lastname>...</lastname>, and <nickname>...</nickname>. As an informal rule, whenever tags or tag-sets are nested inside another tag-set, they are indented to visually demonstrate their relation to to one another.
Another important point to make about tags and tag-sets is that sometimes they have properties. These are included within the brackets of the tag and are separated by spaces. These are used heavily in XHTML to help identify parts of a template and to connect style information with the content. They consist of a keyword, followed by an equals sign (=) and a value, which is in quotation marks. Here’s an example of a paragraph that has been assigned a CLASS to assist it in being styled later on: <p class="infobox">3 New Users Today!!!</p>.
XML is so free-form that you can create whatever tags you want, such as <lovehandles>Wish I had some </lovehandles> or <communismfails>HA!</communismfails>. There are also tags that don’t require opening and closing tags like <br />, which in XHTML represents a line-break and <img> for placing images. XHTML is just a special use of XML. The tags look very similar but are all defined by the WWW Consortium. Although this means you cannot create your own tags, if you use the ones specified by the Consortium the way they dictate, they should look almost identical between browsers (though this isn’t always the case). There are also several versions of the rules, which will be discussed next.
We’ve bounced the word “Tags” a few times already, so it’s time to provide practical examples. Below are some of the most common HTML/XHTML tags and tag-sets. These will be the ones we use for our demonstration template.
| HTML Element | Description |
|---|---|
HTML<html> <head> Non-public stuff </head> <body> Public stuff </body> </html> |
Here’s the most basic web-template that can be concocted. Every web-page must have these elements. Your page must contain the HTML opening and closing tags with the HEAD and BODY tag-sets in between. All of these tags should be preceded by a DOCTYPE (which we’ll cover later) or the browser will read the page in “quirks” mode. |
Site Head<head> Non-public </head> |
The HEAD of the website contains information about the site, such as its title, author, keywords, favicon, and links to connected files such as style-sheets or JavaScript files that must be rendered by the browser at the same time as the web-document. It’s not seen by the public in the browser window, although it’s used by the browser to render the site. |
Site Body<body> Public </body> |
The body is where all the public part of the web-page goes; all the content. |
Headers<h1>...</h1> <h2>...</h2> <h3>...</h3> <h4>...</h4> <h5>...</h5> <h6>...</h6> |
Headers are the major titles of a document, providing hierarchy and naturally dividing the document’s contents. There are up to 6 levels of headers, h1, h2, h3, h4, h5, h6, although most documents only go three levels deep. Commonly any given web-page will have only one h1 level header, the name of the the web-page. The next tier down would perhaps be article titles, using h2 tags, and within articles there might be h3 tags surrounding sub-titles of different sections within an individual article. |
Paragraphs<p>text</p>
|
Paragraphs are just what the name implies, and usually take up the bulk of the textual content of any site. They’re the meat-and-potatoes work-horse of any site. Although browser’s will render text not included in tags as plain generic web-text, it’s best to use the appropriate tags for the appropriate items, so wrap your paragraphs in paragraph tags! It’ll make it a lot easier for anyone using an alternative browsers (teletype, audio, etc…). |
Bold text<b>bold text</b>
|
Emphasized, thicker, or differently colored text in or out of a paragraph. Used to draw attention to specific words or phrases. |
Emphasized text<em>emphasized text</em>
|
Another set of tags for emphasizing text in or out of paragraphs. Most browsers, by default, render EM text as italicized or oblique. |
Italicized text<i>italicized text</i>
|
You get the picture… another way to emphasize text in and out of paragraphs. |
Underlined text<u>underlined text</u>
|
Um… do I really need to say what this is? If you don’t understand, please write in the comments, and I’ll be pleased to answer your question. Really. |
Links<a href="http://www.poop.com">Not StarDock</a>
|
What would any site be without links to other content? This tag-set is an example of using properties, in this case the HREF property, which is the URL for the site referred to by the link. Other properties exist, such as the alt property, which contains text that will be posted to the browser screen if a user hovers their mouse over the link (think Tool-tip). |
Images<img alt="Image Description" src="image.jpg">
|
IMG tags are one way to get imagery in JPG, GIF, or PNG formats into your web-page. Again, note the alt and src properties, the first of which gives a tool-tip and the second providing the location of the image to post. |
Lists
|
Bulleted or numbered Lists are an example of nested tags. Both types use the <li>...</li> tags to contain individual items in the list. The list items themselves are all nested with <ul>...</ul> tags to create a bulleted list, or <ol>...</ol> tags to produce a numbered list.Lists can also be nested, meaning one set of |
Tables<table> <tr> <th>Row 1, Column 1</th> <th>Row 1, Column 2</th> </tr> <tr> <td>Row 2, Column 1</td> <td>Row 2, Column 2</td> </tr> </table> |
Tables, the 1990’s method of HTML web-design, and another example of nested-tags. Use TABLEs for what they were meant for, presenting data, comparisons, and information, NOT layout!
Each table is contained in a set of TABLE tags, with ROWs using |
Code and Pre-formatted text
|
Sometimes in web-sites you need to show actual XHTML code for demonstration purposes. You just write the XHTML code in your web-page, however, the browser will interpret it, instead of displaying it. The CODE, PRE, and SAMP tag-sets are design to let you display these things. The CODE and SAMP tags work in-line, such as in the middle of a paragraph without causing the paragraph to become separated. The PRE tags are meant to encapsulate pre-formatted text, complete with tabs, carriage returns, and the like. If you put brackets around anything in a web-page, it will think it’s poorly formed XML and attempt to render it. You can use symbolic codes, however, available at W3Schools.com to further remedy this. |
Comments<!-- This is a comment -->
|
When coding, sometimes you like to leave notes to yourself, reminders of why something was coded a certain way, or reminders on something to improve. XHTML offers something similar. Using the tags to the left, you can insert text into the web-page that isn’t rendered in the browser. This can come in handy if you want to disable a portion of a page for debugging purposes. |
In addition to the above tags describing specific types of content, there are two tag-sets that are more generic in nature. These can be used to create your own content types, where applicable, but are intended to provide natural separation of information, where applicable.
| HTML Element | Description |
|---|---|
DIVs<div id="footer">XHTML | CSS</div>
|
DIV elements are commonly used to separate a site header from the main content area, from the side-bar navigation, for instance. DIVs are considered BLOCK-LEVEL elements, meaning if you nest DIV elements in a set of paragraph tags with some text, it will disrupt the paragraph, almost like an improperly inserted picture would in a Word document. Think of Headers as BLOCK-LEVEL elements; you cannot nest a header inside a paragraph. Block elements don’t fit in paragraphs, but paragraphs can fit in block elements. |
SPANs<span>pumpkins, smashed</span>
|
SPANs function similarly to DIV elements, but are in-line, by default. This means they don’t cause disruption in paragraphs. Think of BOLD, UNDERLINED, and ITALICIZED text as examples of SPANs, they can exist anywhere within or without a paragraph and just fit into the natural flow of text. |
In short, tags…
< and > symbols.<p>...</p>, only the closing tag has a / stuck immediately inside the braces. There are tags that exist without closing tags, <br/> and <img> as examples.
The adjacent image shows the contents of an basic empty XHTML template. For it to render properly in a web-browser we would name it “pickanyname.html” or “pickanyname.htm”. Let’s pick it apart line by line to show you what’s going on here.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The first line is just the Document Data Type or DTD. It’s a standard piece of web-coding that tells the browser that the rest of this document is an XML file that contains strictly formatted Web Content, as well as providing a link that the browser uses to pull up the information to format the XML properly. Most standards-compliant web-templates use one of the first three of the following specifications:
| DTD Type | DTD Declaration |
|---|---|
| XHTML 1.0 Strict 1.0 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| XHTML 1.0 Transitional 1.0 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| XHTML 1.0 Frameset 1.0 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| HTML 4.01 Strict DTD | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> |
| HTML 4.01 Transitional DTD | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> |
| HTML 4.01 Frameset DTD | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd"> |
| XHTML 1.1 DTD | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
For reasons that are too strange, unusual, and technical, it is usually recommended that you stick to the first 3 DOCTYPES.
Lines 2 and 11 tell the browser where the actual web-document information is, in HTML format. Specifically, line 2 contains the HTML opening tag, and line 11 is the ending tag. Remember, ALL web templates should have an opening and closing HTML tag! You’ll see that inside the opening tag there are two attributes, xmlns and lang. Since this is an XHTML-STRICT document, the xmlns attribute points to another instruction file to be read secretly by your browser, hosted by the W3C. More XHTML specifications. You don’t have to know what it is… just put it in there and things will work smoothly across browsers. The lang attribute just tells the browser that this particular XHTML content is in Unite States ENGLISH. You can find a list of other acceptable alternatives at The W3Schools Website.
Nestled in between the HTML opening and closing tags <html></html> are two additional sets of opening and closing tags:
<head></head><body></body>The <head></head> tags contain information read by the browser but perhaps not directly shown in the browser window. In this particular example the HEAD contains the <title></title> tags, which put the web-pages TITLE up in top of the browser window or browser tab. Commonly in this section of the web document you’ll see tags for <style></style>, which can contain document STYLE information (although we usually want to segregate that to a separate file for reasons previously discussed), or <link rel="" href="" /> tags to include things like web-site title-bar icons or external style-sheets.
In fact, here’s how one could add an external stylesheet and site titlebar icon (the little 16×16 pixel icon that shows up next to the URL of the current web-document in the browser):
<link rel="stylesheet" type="text/css" href="style.css" media="screen" /> <link rel="shortcut icon" href="/favicon.ico" />
In the Photoshop mockup of the site earlier I briefly described some of the features of the site:
Let’s go ahead and add these elements by using DIV tags, as shown to the right, all nested in the BODY tags of the document. Each DIV also contains an ID property and a unique name of my creation. These will create the natural divisions of the document. You can also see that in the HEAD tags, the text between the TITLE tags has been changed to My XHTML/CSS Template, just for grins. I also added two DIVs nested in the DIV with ID of “container”, one for the left-column, which will contain the articles, and one for the right-column, which will contain the navigation links. Note that as all these modifications are made I’m making liberal use of indentation to show which elements are nested in what. To demonstrate the nesting of the left and right columns, I’ve highlighted the closing tag for the “container” DIV in yellow.
Using the proper XHTML/HTML tags to encapsulate structural items in our FreeMind mock-up earlier results in coding that looks like what’s on the right. A level one header was inserted in the Header Division: <h1>MorningBliss XHTML/CSS Template</h1> for the site’s title. A series of fake navigation links have been made and nested in the right-column DIV element. Two fake articles have been created in the left-column division using H2 tags for the headers, like we should, and paragraphs for the individual sample paragraphs. One of the paragraphs in each article has a property tucked inside the opening brackets for the paragraph tag: <p class="excerpt">. This will be used for styling information in the next tutorial, but also serves to remind us that this paragraph is special, it’s a brief summary or teaser of the article to hook reader’s interest. In addition, a paragraph was nested in the Footer Division providing a link to the original template author: <a href="mailto:mrbiotech@skinyourscreen.com">mrbiotech</a> and the license in which the template is being released: <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Creative Commons ANSA3U License</a>
So what does this look like in a browser? The image to the left shows the code we wrote above rendered in Apple’s Safari web-browser. Plain, ‘eh? Don’t get worried yet! Although it’s unstyled, the code we’ve written is Clean Semantic Markup, using the right tags (markup) for the right elements (semantics). The best way to check this is to use a validator, a program to check the XHTML code to make sure everything is written properly and that all the rules are being followed. The W3C offers various on-line validators that will check both on-line XHTML documents (those hosted on a web-server) and off-line XHTML documents (those tested locally on your computer). While developing any web-site, it is strongly recommended you frequently validate your web-document(s). Often a simple mistake like missing a closing bracket or misplaced quotation or forward slash results in a cascade of errors. Validating early and frequently will help pinpoint these errors, facilitating good coding practice.
Basic design principles? Check. Rough idea of the site look? Check. Semantic markup of content? Check.
Next up is styling, which we’re gonna do using some CSS in an external file – right after this commercial break…
XHTML/CSS Standards-Compliant Design is full of all sorts of confusing words, such as XHTML/CSS Standards-Compliant Design. For your convenience, review purposes, or just plain fun (not in that order) I provide the following definitions. Feel free to make suggestions!
The DTD instructions tell the web-browser that anything enclosed with bold tags: <b>Bold Text!</b> is to be rendered as bold text.
This is the bold text.
Skinyourscreen.com is a small hobbyist digital design site for skinners. We have our own miniature library of exclusive skins and tutorials for your enjoyment.
Subscribe to our latest items, skins, and reviews using the links below:
AstonShell | Home of the AstonShell alternative shell environment and AltDesk virtual windows manager for Windows computers.
Blizzle | The best skinning software news site in the galaxy. Period. Great news off the press on Windows, Linux, and Mac OSX shells, software, and skinnables.
Iconfactory | Home of fantastic professional icons, iconsets, and other graphics. Also the makers of CandyBar, iPulse and IconBuilder software
Iconico | Makers of Screen Compass, Protractor, Calipers, and Screen Tracing Paper... great skinnable apps to help you in your skinning.
LS-Universe | LS-Universe is a fantastic place to find cutting edge modules and themes for LiteStep, the grand-daddy/mac-daddy of all alternate shells for Windows.
Planet Aston | Planet Aston's got some nifty FLASH tutorials on how to use and skin AstonShell, my favorite alternative interface for Windows.
Site5 | One generous web-host, and what we use at Skinyourscreen.com. Ruby-On-Rails hosting with FastCGI, 55GB storage, 5TB transfer, dedicated IP, SSH, SSL, unlimited email and databases for 5 FREAKIN' DOLLARS PER MONTH!
Where James Rollins makes you grit your teeth as your favorite characters are seemingly killed only to pop up safe at the end, Iain Banks pushes your favorite characters through gut-wrenching punishment and still has the sadism to kill ‘em all at the end anyway. Don’t worry, it’s the ride that counts (or at least that’s what I keep telling myself).
Few books touch me so indelibly. Rarer still are true stories that leave a mark or impression on my soul. Tuesday’s with Morrie has done that with rapacious wit, candora, melancholy, but most importantly, truth. Life is to be lived, and fully, not sequestered away seeking money, fame. Life is who you love. This is a book to own. I hope my kids will pick it up off the shelf when they’re old enough and give it a read.
Great resource read for anyone thinking of building their own electric guitar. Great examples and nice anecdotal information. Tremendously lacking in schematic or diagramatic details, but rich with verbal suggestions. I’d recommend reading this to get an idea before going online and getting more pertinent details. Organization is a bit confusing, but when used as a reference (i.e.: skipping to a needed section) the book still proves its worth.
An American arctic research submarine stumbles upon an ice-entombed WWII-era Soviet research base holding a secret so sinister that both countries will do anything to obtain it, or ensure it is never seen by the public eye. Not the traditional action-adventure novel, Ice Hunt adds fantastic character-development, accurate science, a highly unpredictable plot to the exciting non-stop peril. Think of Michael Crichton and Dean R. Koontz on a dose of realism and you get Ice Hunt.
Rainlendar on Mac · Sep 11, 2008 by mrbiotech, in
Making Reflections in Photoshop · Sep 01, 2008 by mrbiotech, in
Tutorial: Super glossy dented objects Part 2 · Aug 28, 2008 by mrbiotech, in
Tutorial: Super glossy dented objects · Aug 19, 2008 by mrbiotech, in
Big Fat Footers · Aug 13, 2008 by mrbiotech, in
More Articles...Making Reflections in Photoshop · Sep 01, 2008 by mrbiotech, in
Tutorial: Super glossy dented objects Part 2 · Aug 28, 2008 by mrbiotech, in
Tutorial: Super glossy dented objects · Aug 19, 2008 by mrbiotech, in
Tutorial: Easy tiling images in Corel Painter · Jul 22, 2008 by mrbiotech, in
Tutorial: Radial Symmetry in Photoshop · Jul 09, 2008 by mrbiotech, in
More Tutorials...AstonShell: LambdaRed · Oct 06, 2008 by mrbiotech, in
Free Graphic: Easy Button · Sep 29, 2008 by mrbiotech, in
Free Graphics: Vector Primitives, The Set · Sep 25, 2008 by mrbiotech, in
Free Graphics: Red Pyramid Vectors · Sep 18, 2008 by mrbiotech, in
Sealed, Wallpaper · Sep 13, 2008 by mrbiotech, in
More Downloads...