Skip to content

SiteKickr Web Development

search
search
Feb21February 21, 2011JavaScript, One-Liner

jQuery: Make the first list element expand / collapse the other list elements

$('ul li:first-child').click(function() { $(this).siblings().toggle(); });

Feb18February 18, 2011CSS, Style & Presentation, One-Liner

Remove indenting on UL and OL tags

ol { margin: 0; padding: 0; list-style-position: inside; } By default, most browsers indent list elements from the left margin. The magic above is the…

Feb16February 16, 2011CSS, Style & Presentation, One-Liner

Eliminate page centering “jumps”

body { overflow-y: scroll; } How annoying is it when you link from a "short" page to a "long" page and the vertical scrollbar "jumps"…

Feb15February 15, 2011JavaScript, One-Liner

Use jQuery to highlight the current navigation item

$('a').each(function() {         if(document.URL.indexOf($(this).attr('href')) >= 0) $(this).addClass('selected');    }); Note: This code will add the 'selected' css class to all <a> tags which link to…

Feb15June 8, 2011CSS, Style & Presentation, One-Liner

Registered (®) and Trade (™) marks / superscript line spacing

sup { position: relative; height: 0; bottom: 1ex; line-height: 1em;       vertical-align: baseline; _vertical-align: bottom; /* ie6 hack */ } If you want to adjust…

Posts navigation

Previous 1 2
© 2025 SiteKickr