Skip to main content

Posts

Tips to Write Better CSS Code

CSS is a language that is not difficult to master, but if you use it for a large project, it can be very difficult to manage if you do not follow a defined approach while writing CSS code. Here are few tips that will help you write better and easy to manage CSS code. 1. Don’t Use Global Reset Using global reset to remove default margin and padding from all HTML elements is a strict no-no. Not only it is slow and inefficient way but you’ll have to define margin and padding for each element that needs it. Instead use subset of CSS Resets like one from  Eric Meyer . Not Good view plain copy to clipboard print ? *{  margin :0;  padding :0; }   Better view plain copy to clipboard print ? html, body, div, dl, dt, dd, ul,  h1, h2, h3,   pre , form, label, fieldset, input, p, blockquote, th, td {  margin :0;  padding :0 }   table...

Quick & Easy Way to Implement Drag n Share With jQuery

You must have seen the drag to share functionality on  Mashable  that lets visitors share the content on popular social networks intuitively. Just drag one of the images in an article and you’ll be able to share the article on your favorite social network by dropping the dragged image over its icon. Even, Nettuts has written a nice  tutorial  on how to implement this functionality into your website using jQuery. But here is a much elegant solution to achieve the drag n share effect using jQuery with just a line or two of JavaScript code. Get the prettySociable Plugin To implement this functionality, you will need the  prettySociable jQuery plugin  written by Stéphane Caron. Download and extract the plugin, it contains everything you need to get up and running with drag n share. Include the Required Files To add drag n share to a page, add reference to jquery and prettySociable in your page’s  head tag. The plugin folder also includes  images an...