Subscribe

I have moved to newlyancient.com and will be writing regularly there! Content on this domain is no longer updated, but will be maintained as an archive in its original form.

Archive for December, 2006

Cooking up a Great Design

Bad design is like turning your site into a stereotypical teenage boy’s room with “No Entry” signs and Led Zeppelin posters all over it. Bad design will drive visitors who want to see your content away because they can’t find it or it is too hard to use. Good design is like furnishing a nice house in calm, neutral colors. Good design will welcome visitors into a site and help them to find the content they want - even providing a foot stool in some cases. Great design is like building a beautiful site and laying welcome mats for 20 miles around it. Great design will grab a visitor’s attention, wrap them up in a blanket, and supply them with limitless amounts of hot chocolate. When you have a great design, visitors who might have no interest in your content will stay a while just to feast their eyes (or in some cases, ears). It’s like when you have a party with great food - people will stay even if you are a total jerk.

Take, for example, StartCooking.com. I have absolutely no interest in cooking. I almost didn’t get on high honors because of FCS - another name for torture induced by cooking and endless poorly produced videos. Take me, the macaroni & cheese geek, clicking through the new additions to 9rules and finding StartCooking.com. Instead of immediately leaving due to the topic, I was grabbed by the great design - the colors, simplicity, and general coolness. The design drove me to click around a bit, see all the awesome JavaScript action, and finally watch one of the videos. Surprise, surprise! I actually understood it. The design, production, and simplicity of StartCooking.com eventually drove me to subscribe. *gasp* Who knows, I might actually cook something besides eggs or macaroni & cheese sometime. Great design is where you grab visitors who don’t care about your content and convince them it is worth reading/seeing. On your next website, remember to lay out the welcome mat of a good design.

Semantically Structuring Poetry

Poetry is one of the most expressive and creative writing formats. It allows plenty of artistic freedom and creativity. Historically, layout and style have been of great importance in poetry. In poetry, line and stanza breaks are extremely important as apposed to prose where line breaks can be moved with very little impact upon the writing. When taking poetry to the web, I (and others) feel that this styling and layout needs to be preserved. There are a number of ways to do this using XHTML and CSS. We will use XHTMLto create the semantic structure of our poem and CSS so it can keep up with the latest style. Just like in WordPress, let’s make sure that our code is poetry.

First off, we need to semantically structure the XHTML source of our poetry. This could be achieved using <p>, <ol>, or <pre>. All of these methods have their advantages which we can see. However, some are more semantic than others.

Paragraphs

You could structure each stanza into a <p> tag and add line breaks by using a <br /> tag. While this looks fine, it isn’t really entirely semantic since lines don’t really carry enough importance. You are really only structuring the line breaks, not lines, in this approach. Also, screen readers generally do not place enough emphasis on a line break created by <br /> so entire stanzas may be read as one sentence. Still, this is probably the easiest approach and would look something like this:

HTML:
  1. <div class=“poetry”>
  2. CSS and XHTML intertwine,<br />
  3. to create a semantic web,<br />
  4. of unsurpassed beauty and usability.<br />
  5. Hail the semantic web!
  6. </p>
  7. With a great roar,<br />
  8. the web exploded<br />
  9. paving roads and connecting people<br />
  10. But it destroyed many houses and left behind poetry
  11. </p>
  12. <p class=“poetry”>
  13. Hail the semantic web!<br />
  14. But do not be controlled by it
  15. </p>
  16. </div>

Listed

In some ways, poetry could be though of as an ordered list of lines. Using a list emphasizes the importance of each line greatly. However, poetry isn’t really a list - this is not the semantically correct way to do it. However, if you are really set on the importance of each line you might want to put the poem in an ordered list. This method might be useful if you were teaching an English class and wanted to easily reference each line. If you do want to reference the lines easily you might do it like this:

HTML:
  1. <ol class=“poetry”>
  2. <li>CSS and XHTML intertwine,</li>
  3. <li>to create a semantic web,</li>
  4. <li>of unsurpassed beauty and usability.</li>
  5. <li>Hail the semantic web!</li>
  6. </p>
  7. <li>With a great roar,</li>
  8. <li>the web exploded</li>
  9. <li>paving roads and connecting people</li>
  10. <li>But it destroyed many houses and left behind poetry</li>
  11. </p>
  12. <p class=“important”>
  13. <li>Hail the semantic web!</li>
  14. <li>But do not be controlled by it</li>
  15. </p>
  16. </ol>

Formats Away!

Code is poetry -#. And since code is made with <pre><code> it makes sense that poetry should use <pre> too. To create the easiest and most semantic solution I think it would be best to enclose each stanza in a <pre> tag. The <pre> tag designates preformatted text. A poem certainly falls into this category since we are preformatting the line breaks and stanzas rather than leaving it up to the user agent to decide how it should be formatted. Most screen readers will interpret line breaks enclosed within <pre> correctly by pausing and making it clear that each line is separate. Besides being the best way to do it semantically, a <pre> also makes it the easiest to maintain and change poetry - there are no messy <br /> tags to move. Using <pre> we can create a semantic solution:

HTML:
  1. <div class=“poetry”>
  2. CSS and XHTML intertwine,
  3. to create a semantic web,
  4. of unsurpassed beauty and usability.
  5. Hail the semantic web!
  6. </pre>
  7. With a great roar,
  8. the web exploded
  9. paving roads and connecting people
  10. But it destroyed many houses and left behind poetry
  11. </pre>
  12. <pre class=“important”>
  13. Hail the semantic web!
  14. But do not be controlled by it
  15. </pre>
  16. </div>

In the future, we could use the line element to provide greater control over each line and add another level of importance to the layout of poetry. However, this will not be supported until XHTML 2.0.

The Latest Style

Bad writing lacks style and voice. For poetry, you’ll have to provide the voice but we can add some style to it. Now that we have our semantic XHTML, we turn to CSS to make our poetry look great. To start with, we add a style to the containing div. In order for the poem to appear separated and have a slight shadow you might use something like this:

CSS:
  1. div.poetry {
  2.     background:#FFF6BF;
  3.     color:#333333;
  4.     border-top:1px solid #555555;
  5.     border-left:1px solid #555555;
  6.     border-bottom:3px solid #333333;
  7.     border-right:3px solid #333333;
  8.     padding:10px 20px;
  9.     }

Once the container is styled, we can make the stanzas appear the way we want. This is where we specify a font since many browsers will set a special font for the <pre> tag. We also ensure that white space is interpreted correctly. We should add this style to our <pre> tags.
CSS:
  1. div.poetry pre {
  2.     white-space:pre;
  3.     font-family:“Comic Sans MS”, comic sans, “brush Script MT”, brush script, “Zapfino”, “Marker Felt”, cursive;
  4.     margin:0px 0px 10px 0px;
  5.     }

Things should be looking pretty rosy now. You may want to add some additional fanciness by styling the first letter or line of each stanza or placing special emphasis on a stanza. With all our sweet styles added on we will end up with this beautiful poem.

CSS:
  1. div.poetry pre:first-line {
  2.     color:#222222;
  3.     }
  4. div.poetry pre:first-letter {
  5.     font-weight:bold;
  6.     font-size:120%;
  7.     }
  8. div.poetry pre.important {
  9.     font-size:105%;
  10.     }

By using <pre> tags to semantically structure our stanzas and using CSS to make it look pretty we have ensured that none of the authenticity of our poetry will be lost when it is translated to code. This is the way that I believe poetry should be created although other methods certainly have valid arguments. If you have another idea or think that poetry should be created using some other method, please speak up. Remember, just as code is poetry, your poetry must act like code.

Two Dead Boys

Just like the national media, I must be really hard up for content to be posting something this simple. Yet, if it is funny and enjoyable (unlike Schwarzenegger) why not post it? So, here I present the tale of two dead boys. This is a classic that can be found all over the web.

  1. One fine day in the middle of the night,
  2. Two dead boys got up to fight,
  3. Back to back they faced each other,
  4. Drew their swords and shot each other.
  5. One was blind and the other couldn’t, see
  6. So they chose a dummy for a referee.
  7. A blind man went to see fair play,
  8. A dumb man went to shout “hooray!”
  9. A paralyzed donkey passing by,
  10. Kicked the blind man in the eye,
  11. Knocked him through a nine inch wall,
  12. Into a dry ditch and drowned them all,
  13. A deaf policeman heard the noise,
  14. And came to arrest the two dead boys,
  15. If you don’t believe this story’s true,
  16. Ask the blind man he saw it too!