Thursday, April 24th, 2008
This is an old question but worthy of a mention once again especially as I seem to have spent the last few days repeatedly pointing out to posters why their page isn’t displaying properly. No matter how good a coder you are no one is perfect and the odd typo or spare character will often creep into your code when you aren’t looking.
Why Should I Validate?
I donâ€™t know the answer â€œwhy you should validateâ€ but I certainly know why I validate.
In a recent article on Search-This a poster commented that it was unnecessary to validate HTML and CSS and served little benefit so I thought it would be wise to explain why I always validate and why it is good for me. You can then make up your own minds whether you should validate or not.
Monday, April 21st, 2008
GM_log become one’s best debugging friends. To make writing Greasemonkey scripts a bit easier, the chaps on the Gmail team supplied an API, which one commenter describes as “truly incredible, forward thinking”. It really is quite nice.
Yesterday I decided to add a little bit of functionality to Gmail. I wanted to be able to isolate messages from a mailing list I subscribe to that nobody had replied to. This would require marking as read “conversations” or messages containing “Re:” at the start of the subject line. The obvious place to put links to do this is along with the other “selectors” above the thread list (Figure 1).
I call them “selectors” simply because Gmail has given each “link” (actually a span) a custom
selector attribute. The original markup before adding the links after “Unstarred” looks like this (it isn’t nicely indented in Gmail’s code though):
So, it looks pretty simple to add a couple of commas and two more spans. And it is, but how to access the containing
div is what the Gmail API makes easier. This is the complete script, and we’ll start off with the main loading business and the function that handles the adding of these two new links,
Monday, April 14th, 2008
As you run your blog you may find yourself building relationships with some of your visitors. I know that when someone puts in the time to be a repeat commentator to Search-This I often find myself wanting to investigate that person a little. I may visit their blog and read a handful of their posts. I then usually look for an about page to get a brief bio of the person. I guess we all like to know who we’re inviting into our homes…
One of the problems I had at Search-This was that I could never easily tell how many comments a given person contributed. It would be nice to know who our top commentators are, not just for a given month but overall.
In addition to satisfying my own curiosity, I thought you guys might also like to know how many comments total you have logged.
Now we both can tell!
Simply mouseover the dude representing you for your comment and it shows you your total comments. It also displays links to the last three posts you commented in. See the screenshot below:
Wednesday, April 9th, 2008
Sometimes the simplest things can turn out to be more complicated than you ever imagined. This can sometimes be the case with CSS and cross-browser support. It’s no wonder that beginners to CSS often throw their hands up and revert back to using tables because some bug or other has thrown them off course.
As an example I thought I’d document a few problems that crop up time and time again with absolute positioned elements in our favorite browser – yes, IE6, I’m talking about you again!
Removed From The Flow
Absolute elements are removed from the flow and have no affect on surrounding content. Conversely surrounding content should not be able to affect absolute elements either. That’s not quite true as a positioned element will create a stacking context for further positioned elements but that’s as far as any effect will go. (We often set position:relative on a parent so that the absolutely positioned child can be placed in respect of that parent and not the viewport.)
In effect the absolute element should not care what else goes on around it and is oblivious to anything except its own start position. IE, however, has a few peculiar issues with this in the simplest of layouts and we will document a few of the most common and thought-provoking problems you will encounter on a day to day basis.
The following examples are a little contrived in order to show the effects at the simplest level and could be done by other methods but that’s not the point of the . Exercise