Easy CSS compatability

For every web developer / designer the issues in earlier versions of IE can be a real pain. Even simple styling such as margins and padding can make a design look like it’s upside down.

The obvious hacks for CSS involve using a separate style sheet and the old school <!– if IE–> but I always manage to avoid these mainly because I like to keep all the CSS in one file to keep overall page size down and it’s also more easier to fix other issues when all the CSS rules are in one file.

IE  issues

The easiest way to target issues in IE6 is to use the _property hack.

_margin:20px;  /// this will only be used by IE 6

There is also a hack for IE7 which works in a similor way using the *

*margin:20px;  /// this will only be used by IE 7

Although these may cause CSS problems to validators they are still very valid fixes and I have never seen a drawback to using these.

PHP and dynamic URLs

Whenever I make a new website now I always think about what the urls will need to be like. Most off the shelf CMS platforms will have a plug in or option to enables similar functionality.  But if your writing the site yourself you will want to be able to convert URL from post Id’s to post names to Urls and back again.

I have used many methods to do this in the past but recently I found two really useful built in PHP functions. urlencode() and urldecode().

Alternatives to using urlencode() would be writing your own function to convert all the url unfriendly symbols, slashes, spaces etc. into HTML entities or just replacing them with hyphens.

Again PHP has an built in function for everyhting.

Posted in PHP.