Recent Entries

Frontend Friday: Watch out for Divitis

Entry posted on 2008-07-04 8:00 am

Back when I first started using CSS, my favorite tag was undoubtedly the <div>. It was so versatile, and I did everything I could with that tag. It introduced me to absolute positioning and the CSS in general, and I’m forever grateful, but it also brought me away from the basics: HTML as a markup language. It’s also known as divitis: that is, having one too many <div> tags.

The result was code bloat, and once I started weaning away from this practice, I had hundreds of files to update, as they all looked like:

<div class="content">
<div class="title">Some heading!</div>
<div class="date">July 4, 2008</div>
<p>This is some of the content of the page. Yay!</p>
<div class="subtitle">Some subheading</div>
</div>

(I’m sure if you look hard enough you’ll find a couple of my older sites still sporting this sort of markup.)

Movements and events like the annual CSS Naked Day woke me (and hopefully a few others) to the sad truth that as web developers and designers, we can be so obsessive about needing every single pixel in place, but completely forget about keeping the house clean. The impact may be minimal at the onset (i.e., “hey, everyone sees the pretty decors after all!”) but just like your house after a rush cleaning because people are coming over tonight, you have to deal with guests stumbling into hidden mess, things not in the right place, and a painful cleanup job afterward.

(Of course, there’s the other end of the spectrum where holy wars are raged between the use of a <ul> and a <table> tag, which is just as bad, IMO.)

There are three things I do when working on a website to help me keep as close to “clean” as possible:

  1. Keep markup in the back of your mind when creating your design. The best example of this is creating a navigation menu. Can it be done in lists? What sort of arcane CSS-fu is needed to make it work like so?
  2. Start with a bare HTML page. I’m doing this right now for a couple of projects. I have wireframes (structures) where I’ve laid out roughly where things are going, but nothing else. No colors, no images, no JavaScript, just plain ol’ markup-py goodness.
  3. Once done, remove stylesheets and take a look. It’s easy for me to lose track of things when I’m on a roll, so this one personally has made me cringe a lot of times. Temporarily removing all styles from my work is a good way to see if it’s still readable and navigable even without all my pretty styles, and that it’s as close to how I designed it as possible. (This pretty much destroys all unordered lists masquerading as tables… so beware.)

Remember: there are 91 HTML tags available, one of which might serve the need and communicate your intent better. But don’t force it: sometimes saying nothing at all is better than being misunderstood.

Blockquotes, pull quotes, and quotes

Entry posted on 2008-07-01 11:47 pm

Smashing Magazine’s Block Quotes and Pull Quotes article is interesting, and something everyone should skim through, at least.

According to HTML specifications, there are three elements which are supposed to semantically mark up quotations, namely <blockquote>, <q> and <cite>. Although all intended to markup quotes, they should be used in different contexts. So when should you use what?

I’ve only seen <cite> used fairly recently, while at work in Y!, which sadly doesn’t say a lot about myself and my friendship with various markup tags available. I’ve been using it a bit more since. The best thing I’ve learned from the article, however, is this:

Although <q> is almost never used, it has some useful properties. For instance, you can specify the appearance of quotes within the <q>-element via CSS. That’s reasonable as different languages use different quotation marks for the same purpose. For instance, these ones:

Q {}
Q { quotes: '»' '«'   }
Q { quotes: '„' '“' }

Modern browsers support this way of styling. Of course, Internet Explorer (even in its 8th version) doesn’t support it although it knows <q> pretty well…

The article also shows a few bad and good practices for usage of block and pull quotes. I’ll admit I’ve fallen victim to a few of those questionable practices, but it’s never too late to improve things. ;)

Frontend Friday: Tools of the trade

Entry posted on 2008-06-27 8:00 am

I’m finally pushing through with an idea I’ve had for a while: Frontend Friday! Every Friday, I will be posting an entry about frontend development work, which includes topics on HTML, CSS, JavaScript, and basically anything related to the implementation of designs and UI on the web. These may be simple solutions you might know about, or weird experiments and topics that concern those who code layouts, whether done as a hobby or as part of work.

For the first Frontend Friday post, I’ve decided to write about a topic that’s rather central for all web developers: the tools that we use. We all use different programs and extensions and scripts to help us code up a nice layout for our websites. I wanted to share some of mine, and I hope you find them useful.

My top 7 tools:

  1. Aptana Studio

    I’ve been using Aptana well over a year now, and in fact I wrote a review about the web IDE before. Because it stems from Eclipse, and Java, it suffers a bit of lag especially when working with large files; I wouldn’t recommend using it for that quick 30-second style fix on your website.

    But working on websites that contains quite a few bells and whistles, I find Aptana to be quite helpful. The Project pane stores all ongoing projects, the Validation tab is quick to look up typos which result in syntax errors, the Outline pane makes jumping between functions and HTML nodes a breeze, and Code Suggest is always great to have around. (You should take a look at my review if you want to know more; while that was for the beta version, it’s still relevant.)

  2. Firefox

    Yes, Firefox just had to be there. I will admit that as of late I’d been very frustrated with Firefox’s memory-hogging practices and annoying lag, and if it weren’t for Firefox being insanely great for web development, I might have dropped it for the faster Safari. Firefox is a great standards-compliant browser, plus it provides an avenue for a plethora of web-developer-friendly tools, some of which are…

  3. Web Developer Toolbar

    Chris Pederick’s Web Developer Toolbar is impossible to live without. It’s lightweight and contains a lot of helpful tools: disabling cache to make sure you see your CSS updates, cookie manipulation, CSS lookups, markup and style tools for debugging, browser resizer, viewing generated source (for all those whizzy JS things), and more. If you’re a developer and you don’t have this on Firefox yet… what cave have you been living in?!

  4. Firebug

    Actually, Firebug vied with the Web Developer Toolbar for the “must have” spot, with the toolbar winning simply because it’s lighter and more mainstream: even if you’re a hobbyist making personal websites during your free time, the toolbar is useful. Firebug is also a must-have, but mainly for more heavy duty stuff, and especially for debugging purposes: completely clueless what styles are messing things up on a certain element? Lost as to what is happening to your variables when running JS? Firebug makes digging into code easy. I can’t count the number of times Firebug has saved me hours of trawling through CSS or numerous alert() calls.

  5. Multiple Internet Explorer installations

    There are numerous multiple IE tools out there, but the one I personally use on my Windows test machine is TredoSoft’s Multiple IE. I really only test for IE6 and IE7, though (I should install IE8 soon, too…). It’s a bit of a pain, but that’s the way life rolls. The IE Developer Toolbar is also a must-have for IE-proofing your website. I hope they update the toolbar to include a debugger soon.

    Naturally, you will also need other browsers installed, according to what you wish to test with. I test according to Yahoo!’s list of A-grade browsers, even for my personal work (well, in varying degrees, as I don’t have multiple images of Windows sitting in my personal machine, for instance).

  6. YSlow

    YSlow analyzes my pages’ load times. I typically only use this nearer to the end of development, to check if I need to combine more images into sprites, chunk together CSS and JS, etc. It’s definitely a good guideline checker for webdev best practices, which may or may not be critical for you, depending on what you are working on.

    YSlow takes into consideration Yahoo!’s rules for high performance websites, which every web geek into making websites should read through at least once.

  7. Fiddler and/or Tamper Data

    These two are mostly useful for deeper digging into the communication between your website and the server, and may or may not be applicable for the type of work you do. I find it highly useful for verifying form submissions’ raw data and AJAX requests — you can stop the data transmission, fudge up the content, and release it, which helps you trap bugs and issues.

    Tamper Data is a nifty Firefox extension for this purpose, and Fiddler is an HTTP debugger tool, much more robust than Tamper Data. Unfortunately, Fiddler is not available on Mac OSX — I’ve been looking for a good alternative for a while now (Paros looks like an interesting alternative, but for some reason I can’t get it to start monitoring traffic).

So those are the top 7 tools I use for working with code. What are yours?

Enthusiast 3.1.4 Released

Entry posted on 2008-06-01 11:11 am

I’ve been testing Enthusiast 3.1.4 on Aking Mahal for a few weeks now, and now I’ve released Enthusiast version 3.1.4, which incorporates a number of bug fixes plus a special feature — special because it gets added at a bugfix-level upgrade.

This update includes:

  • Added mass rejection of new members feature
  • Fixed bug where PEAR Mail class gets called twice when joining in certain server and/or website settings
  • Fixed bug where showing/hiding of member emails do not get updated correctly when members update their information
  • Fixed bug where there are still target attributes in links for the fanlisting statistics
  • Fixed bug where non-numerical offsets are allowed in the pagination query

I’ve been vocal about not adding a mass-rejection feature for Enthusiast, but in the interest of helping those of us whose fanlistings get spammed, and the goal to make sure Enthusiast caters to an ever wider audience due to its openness and flexibility, I’ve finally added the feature in. However, as this is just one additional feature, I decided not to bump up the version to 3.2, as it feels rather sad that way ;)

You can download the full 3.1.4 release, or get an upgrade zip file instead.

If there are problems with regards to this upgrade, please feel free to leave comments, however all regular troubleshooting requests and support-related questions should be directed to the Enthusiast support forum at CodeGrrl. Thanks!

Definition of a table-less layout

Entry posted on 2008-05-31 4:18 pm

What does “table-less layout” mean to you?

Recently I’ve come across a number of discussions about what constitutes a table-less layout, and most developers’ definitions can be pooled into two differing definitions of this term:

  1. A table-less layout used on a website means that no tables are used on the website, none at all, none whatsoever. For all content, use paragraphs, divs, ordered/unordered lists, spans, and the like. Tables are for newbiez.
  2. A table-less layout used on a website means that tables are not used to lay out graphical elements and content on the webpage, i.e., the header, footer, content, sidebar, etc., but uses tables for tabular data when it’s appropriate.

Personally, I believe in the second definition of a table-less layout, and I was actually amazed to learn how many people actually believe in the first definition. At the risk of a semantics war, I feel like I have to post about this. It’s probably due to all the HTML/CSS/JS/etc talk I’m exposed to for most of the day while at work; I’m exposed to debates about semantics, accessibility, etc. with some regularity.

HTML is a markup language: Hypertext Markup Language. Any markup language (HTML, XHTML, XML, YAML, etc) is only as good as the structures and tags one uses to markup their data. Using appropriate markup in order to provide inherent meaning to data is important. See for example:

<h1>This is a page heading</h1>
<p>This is some paragraph text. If I am a computer, I wouldn't understand the meaning of these words, but the P tag I, as the developer, used to encapsulate this text tells the computer that this is a paragraph. Now I want to quote someone.</p>
<blockquote><p>Now I am quoting someone, and the computer knows it's a quote because this is inside appropriate tags. This is me trying to emphasize something.. And now my quote is done so I need to cite my source.</p><cite>This is the author of my quote</cite></blockquote>
<p>This is another paragraph, and this time I need to outline a step-by-step process, like so:</p>
<ol>
<li> Step one: do this. </li>
<li> Step two: do that. </li>
<li> Step three: do more things. <?li>
</ol>
<h2>This is another heading, but of lesser importance than h1</h2>
<p>And more paragraphs, but for now this is a strongly-emphasized chunk of text.</p>

Using appropriate, semantic markup is important for us as developers, because we are the ones who develop the web. We are the ones who program the content that is the meat of the web. If we use meaningful markup, it will be easier and easier for computers to index and determine our content, and to provide it to others who need that content.

That said, semantics is hazy, and data can be different in meaning for each developer, for each programmer. Sometimes it does make sense to use lists over tables, when it’s more appropriate. But when you’re talking about correlated data, data you see on charts, feature and price matrices, and the like, it’s usually more appropriate to use a table, because by definition, it is tabular data we are representing.

For example, a price list. It’s a list, right? So here we’re using a list:

<h1>Price list</h1>
<ul>
   <li>
      <ul class="header">
         <li> Product name </li>
         <li> Colors available </li>
         <li> Stock availability </li>
         <li> Price </li>
      </ul>
   </li>
   <li>
      <ul>
         <li class="header"> Product one </li>
         <li> Blue and green </li>
         <li> In stock </li>
         <li> $10.00 </li>
      </ul>
   </li>
   <li>
      <ul>
         <li class="header"> Product two </li>
         <li> Blue and green </li>
         <li> In stock </li>
         <li> $15.00 </li>
      </ul>
   </li>
   <li>
      <ul>
         <li class="header"> Product three </li>
         <li> Blue and green </li>
         <li> Out of stock </li>
         <li> $20.00 </li>
      </ul>
   </li>
</ul>

And here is the same data marked up in a table:

<h1>Price list</h1>
<table>
   <tr>
      <th> Product name </th>
      <th> Colors available </th>
      <th> Stock availability </th>
      <th> Price </th>
   </tr>
   <tr>
      <th> Product one </th>
      <td> Blue and green </td>
      <td> In stock </td>
      <td> $10 </td>
   </tr>
   <tr>
      <th> Product two </th>
      <td> Blue and green </td>
      <td> In stock </td>
      <td> $15 </td>
   </tr>
   <tr>
      <th> Product three </th>
      <td> Blue and green </td>
      <td> In stock </td>
      <td> $20 </td>
   </tr>
</table>

Example #2 has lesser code (better in terms of page size and load time), needs lesser CSS since you don’t have to muck with floats (better, again, in terms of CSS stylesheet size and load time), and makes sense because we are looking at tabular data: we have specific information connected to a certain product (as defined by the headings).

(Also, shameless pimping: YUI can parse tables and show dynamically-generated charts (from your table’s data) using DataTable–currently in beta.)

If makes more meaningful sense (in terms of markup) to use a list over tables, sure, I’d use lists, and would promote the use of lists as well. But what I’m against is the use of lists for tabular data “just because”just because I want to make a “table-less” website, just because it’s kewl to sweat it out using lists in lieu of tables and I wanna show I’ve got the HTML/CSS chops to do so, just because I feel that I have to prove myself to others.

I feel a lot of newer web developers end up doing this because of those reasons; I’m a victim of this myself. I was this way when I started not using tables in layouts way back in 2000, I was this way when I started using XHTML to markup my pages a few years back (three or so?). I jumped in on the bandwagon because it was the cool thing to do, because I can say, hey, I can do this. Now I have a lot of websites I need to update because my understanding of the semantic web has changed.

That said–I know there are other ways to mark up that chunk of dummy data I put up. Are there other ways of doing it that is meaningful to you as a developer? What criteria do you use when creating table-less layouts?

More entries