This is achieved using CSS attribute selectors. Basically I have a CSS rule that checks the destination of every link and if it ends in .zip then it adds the little icon. There are six easy to use CSS attribute selectors that allow you to match attributes in different ways: starts with, ends with, contains, is exactly equal to, has the attribute, match one item in a space separated list.So that I don't have to pollute my main template file with lots of rules just to show an example of each I've put together a separate demo page. If you want more details than there are in the demo then take a look at the CSS3 Selectors specification, which defines these attribute selectors as well as a whole load of others.
If you intend to use any of these CSS rules it is worth remembering that to get them to work at all in Internet Explorer not only do you have to be using version 7 but you must ensure that your HTML page specifies the HTML 4.01 strict doctype, because in quirks mode IE totally ignores all these CSS rules.


Saturday, 18 August 2007



Seem to have worked out what I wanted to add and added it to template but how do I upload the relevant .jpg file. i.e. how did you upload your little icons?
Right, if I remember correctly your blog is hosted on blogspot so you won't easily be able to upload the images to the same server as the blog. However, in the CSS rules you can put full URLs to specify the location of the images. SO I'd suggest creating a folder to hold blog related stuff in your own webspace and then link to them from there,
Mark
Post a Comment