Showing posts with label one liner. Show all posts
Showing posts with label one liner. Show all posts

Sunday, June 27, 2010

External link track - a one liner

If you use Google Analytics and would like to track which ones of your external links people click on while checking out your website, all you have to do is to add the 'onClick' attribute to the a (anchor) tag in question.

Here's an example code that you could use:

Monday, June 14, 2010

The easiest way to scale your picture or image in html - a one liner

The easiest way to scale your picture or image in html - a one linerSuppose you have a column on the side or sidebar where you want to put images with different sizes however also making sure that their widths keep the same distance from the sides of the columns, you could simply only set the width of the img tag (of course, dpending on you layout, you could use the height only):

(click in the box to highlight the code for copy)

Thursday, March 04, 2010

Getting rid of the dotted outline of the a tag - a one liner

It annoyed me too, but I haven't really given it a second thought and finally I found it accidentally in the blog post Making the WordPress Menu Smarter while looking for something completely different.

I took the interesting part out of the post for you, here you are:

Saturday, February 13, 2010

CSS Uppercase / All Caps - a one liner

Well, I never really needed it, but then I did so I looked it up quickly and found this post about CSS Uppercase / All Caps. Easy-peasy :)

Wednesday, February 03, 2010

abolute position within div - a one liner

If you want to use absolute positioning within a div, you just have to set the parent div to relative.

You should put this in the head between the sytle tags:

Friday, January 22, 2010

z-index only with absolute position - a one liner

A one liner can be very useful sometimes, so just read the title, hope it helps! ;)

Thursday, January 14, 2010

Center div with margin: 0 auto - a one liner

The best and cleanest way to center a div is to use the margin: 0 auto attributes in styles. Make sure however that you set a width of the div to something specific otherwise it's not going to work.

Note: it seems that this unfortunately doesn't work in IE7. Alternatively you may use the <center> tag.

See an example of the style attribute below:
(click in the box to highlight the code for copy)