Web dev tips #2
So, this probably doesn't apply to a lot of folks, but if you're trying to use tables for page layout (i.e. for HTML emails), you may notice that Firefox inserts blank space at the bottom of each image that you just can't get rid of. The cause is that the <img> tag has the "display: inline" property, which means that Firefox allows space for "descenders" (i.e. the parts of letters that go below the baseline; examples: jgpq). The solution in table layouts is to assign each image the "display: block" property. Alternately, you can use adjust the "vertical-align" property on the image. Here's a page with a more detailed look at the problem/solution.
Another thing I just wanted to mention for my own reference was short conditionals in PHP. Example:
<? if(empty($_GET['id'])) echo 'No ID'; else echo 'ID: '.$_GET['id']; ?>
Can be replaced with:
<?=empty($_GET['id'])?'No ID':'ID: '.$_GET['id']?>
The syntax can be broken down into CONDITIONAL ? IF TRUE : IF FALSE
It's basically just a way to make your code concise and look esoteric while doing so.
Comments