CSS-Tricks*
A Web Design Community curated by Chris Coyier
A little dab'll do ya
Code Snippets
Code Snippets Submit one!
- CSS
- “Stitched” Look
- Absolute Center (Vertical & Horizontal) an Image
- Accessibility/SEO Friendly CSS Hiding
- All Stylesheet Media Types
- Basic Link Rollover as CSS Sprite
- Basics of Google Font API
- Better Helvetica
- Blurry Text
- Browser Specific Hacks
- Center DIV with Dynamic Height
- Centering a Website
- Change Text Selection Color
- Comments in CSS
- Compress CSS with PHP
- Cross Browser Inline-Block
- Cross Browser Opacity
- Cross-Browser hr Styling
- Cross-Browser Min Height
- CSS Box Shadow
- CSS Diagnostics
- CSS Font Families
- CSS Hacks Targeting Firefox
- CSS Only Image Preloading
- CSS Text Shadow
- CSS Triangle
- CSS3 Zebra Striping a Table
- Drop Caps
- End Articles with Ivy Leaf
- Exactly Center an Image/Div Horizontally and Vertically
- Fancy Ampersand
- Fixed Footer
- Fixed Positioning in IE 6
- Flip an Image
- Font Shorthand
- Font Stacks
- Force Element To Self-Clear its Children
- Force Vertical Scrollbar
- Give Clickable Elements a Pointer Cursor
- Gradient Text
- Internationalization Language CSS
- iPad Orientation CSS
- iPad-Specific CSS
- Link Pseudo-Classes (In Order)
- Make “Pre” Text Wrap
- Media Queries for Standard Devices
- Meyer Reset
- Multiple Backgrounds Syntax
- Multiple Borders
- Multiple Columns
- Not-Terrible Image Resizing in IE
- Page Curl Shadows
- Perfect CSS Sprite / Sliding Doors Button
- Picross Style Buttons
- PNG Hack/Fix for IE 6
- Prevent Superscripts and Subscripts from Affecting Line-Height
- Print URL After Links
- Quality Abbreviations
- Remove Button Text in IE7
- Remove Dotted Link Borders
- Remove Margins for First/Last Elements
- Remove Scrollbar from Textarea in IE
- Removing Dotted Outline
- Rounded Corners
- Scale on Hover with Webkit Transition
- Simple and Nice Blockquote Styling
- Standard CSS Image Replacement
- Sticky Footer
- Style Links Depending on Destination
- Style Override Technique
- Style Placeholder Text
- Text Dripping Blood
- Text Rotation
- Top Shadow
- Truncate String with Ellipsis
- Using @font-face
- WebKit Keyframe Animation Syntax
- HTAccess
- 301 Redirects
- Active Gzip Compression
- Allow Single URL Through .htaccess Password Protection
- Custom Error Pages
- Different Directory Index Page
- Fancy Indexing
- Force charset utf-8
- Force Correct content-type for XHTML Documents
- Force Favicon Requests to Correct Location
- Force Files to Download (Not Open in Browser)
- Get The Dreamhost Stats Page Working on a WordPress Site
- iPad Detection
- iPhone Catcher
- Password Protect Folder(s)
- PHP Error Logging
- Prevent Image Hotlinking
- Remove File Extention from URLs
- Set Expires
- Shock Teenage Gangsters with wp-config Redirect
- Subdirectories URL Internally Redirect to Query String
- Temporary Maintenance using Mod_Rewrite
- Use PHP inside JavaScript
- WWW / No-WWW
- HTML
- Add Body Class Just For IE
- Add Spaces to Dock in OS X
- Basic Microformatted hCard
- Comments in HTML
- Cufon 101
- Embedding Flash
- Embedding Quicktime
- Embedding Windows Media
- Empty Table Markup
- Example Form Markup
- Form Submission Opens New Tab/Window
- Get Directions Form (Google Maps)
- Get Rid of White Flash when iframe Loads
- Glyphs
- HTML5 Article Structure with hNews
- HTML5 Page Structure
- Keep Flash Behind Other Elements
- Left & Right Halves Layout
- Lorem Ipsum Paragraph
- Mailto Links
- Make IE 6 Crash
- Meta Refresh
- Meta Tag For Forcing IE 8 to Behave Like IE 7
- Multiple File Input
- Open Link in a New Window
- Proper Tags for Displaying Content Edits
- Serving Up Universal IE 6 Stylesheet
- Set iPhone Bookmark Icon
- Standard List Navigation
- Stop IE Page Load Flicker
- Test Page
- The Common DOCTYPES
- Tooltips for Acronyms
- Top & Bottom Halves Layout
- Turn Off Autocomplete for Input
- Use Firebug in Any Browser
- View Source of RSS Feed in Firefox
- XHTML 1.0 STRICT Page Structure
- JavaScript
- “Go Back” Button
- 1024×768 Bookmarklet
- Auto Select Textarea Text
- Basic Alert
- Call Function with Random Timer
- Check if Number is Even/Odd
- Clear Field on Focus
- Comments in JavaScript
- CSS for when JavaScript is Enabled
- Current Page with JavaScript
- Detect Internet Explorer
- Detect Javascript On/Off, With Notification
- Different Stylesheet Pending the Time of Day
- Different Stylesheets for Different Days of the Week
- Empty an Array
- Error-Free Firebug Logging
- Format Currency
- Get URL and URL Parts in JavaScript
- Get URL Variables
- Get YouTube Key from a Link
- Global Variables
- htmlEntities for JavaScript
- Input with Disappearing Background Image
- Intervals
- JavaScript Array Contains
- JavaScript MD5
- JavaScript Required Content with Fallback Content
- Loop Through Array Without Wasteful Lookups
- Make HTML5 Elements Work in Old IE
- Modern Event Handling
- Multiline String Variables in JavaScript
- Perform Function At Timed Intervals
- Prevent Background Image Flickering in IE
- Prevent Embedded JavaScript from Failing Validation
- Put Comma Values in Numbers
- Random Hex Color
- Redirect
- Redirect Mobile Devices
- Shuffle Array
- Strip HTML Tags in JavaScript
- Test for Internet Explorer in JavaScript
- Test if Element Supports Attribute
- Toggle (Show/Hide) Element
- Trim First/Last Characters in String
- Validate HTML Bookmarklet
- Viewport Size, Screen Resolution, Mouse Postition
- Word Count Bookmarklet
- jQuery
- Add Non-Breaking Space on Title to Prevent Widows
- Adding/Removing Class on Hover
- Append Site Overlay DIV
- Automatically Discover Document Links And Apply Class
- Better Broken Image Handling
- Browser Detection + Apply Classes to HTML Element
- Change WMode with jQuery
- Check for Empty Elements
- Check if Checkbox is Checked
- Check if Element Exists
- Check if Element is inside Another Specific Element
- Check if Event was Triggered or Native
- Check if jQuery is Loaded
- Clear Default Search String on Focus
- Click Once and Unbind
- Combine Slide and Fade Functions
- Cycle Through a List
- Detect First Visible Element of Certain Class
- Disable / Re-enable Inputs
- Disable Parent Links in Nested List Navigation
- Display Browser and Version
- Display Last Tweet
- Display Latest FeedBurner Post
- Display Only First X Divs, Toggle Rest
- Equalize Heights of Divs
- Exclude $(this) from Selector
- Fade Image Into Another Image
- Fade One Image to Another Menu
- Fallback for CDN hosted jQuery
- Find all Internal Links
- Fire Event When User is Idle
- Fix Min/Max-Width for Browsers Without Native Support
- Fix Select Dropdown Cutoff in IE 7
- Fixing .load() in IE for cached images
- Fixing IE z-index
- Get X, Y Coordinates of Mouse Within Box
- Highlight All Links To Current Page
- Highlight Related Label when Input in Focus
- Image Preloader
- Inputs That Remember Original Value
- Insert Element Between Other Elements
- jQuery Duplicate Plugin
- jQuery JSON getting with error catching
- jQuery Plugin Template
- jQuery Sticky Footer
- jQuery Tweetify Text
- jQuery Zebra Stripe a Table
- Keep Text Inputs in Sync
- Konami Code
- Link Nudging
- Load jQuery Only If Not Present
- Load Only a Section of a Page
- Loading jQuery
- Make Entire Div Clickable
- Open External Links In New Window
- outerHTML jQuery Plugin
- Partial Page Refresh
- Password Strength
- Persistant Headers on Tables
- Resize iFrame to Fit Content (Same Domain Only)
- Run JavaScript Only After Entire Page Has Loaded
- Scroll Page Horizontally With Mouse Wheel
- Search/Replace
- Select Element Only if Children are Not Animated
- Select List Item Only If Doesn’t Contain Another List (and is top level)
- Serialize Form to JSON
- Set/Clear Default Input Value
- Show Most Recent Flickr Uploads
- Show Most Recent Picasaweb Uploads
- Shuffle Children
- Shuffle DOM Elements
- Simple jQuery Accordion
- Sliding Background Links
- Smarter Event Binding
- Smooth Scrolling
- Styled Popup Menu
- Target Only External Links
- Trigger Click on Input when Label is Clicked
- Triple Click Event
- Validate Age
- Window load event with minimum delay
- Working with Attributes
- PHP
- Adjust Server Time
- Append Login Credentials to URL
- Append Non-Breaking Space Between Last Two Words
- Applying Even/Odd Classes
- Associative Array Syntax
- Automatic Copyright Year
- Automatic Mailto Links
- Backup Database
- Basic Database Connection, Random Query, Display Result
- Basic SimplePie Usage
- Build a Calendar Table
- Change Date from dd/mm/yyyy to yyyy-dd-mm
- Change Graphics Based on Season
- Change Month Number to Month Name
- Check if File Exists / Append Number to Name
- Check if Website is Available
- Cleaning Variables
- Comments in PHP
- Concatenate Array for Human Reading
- Convert BR to Newline
- Convert Comma Separated String into Array
- Convert HEX to RGB
- Count Script Excecution Time
- Create Unique AlphaNumeric
- Create URL Slug from Post Title
- Crop Image
- Cross Domain GET Forwarding
- Debugging $_REQUEST
- Detect AJAX Request
- Detect IE5 or IE6
- Discover and Display Meta Tags
- Display a User Gravatar from an Email Address
- Display Array Contents
- Display FeedBurner Feed Count
- Display Styled Directory Contents
- Email Address Validation
- English Time to Seconds
- Error Page to Handle All Errors
- Extract Email Addresses
- Find All Links on a Page
- Find File Extension
- Find Highest Numerically Named File
- Find the Full Path to a File
- Find URLs in Text, Make Links
- Force Leading Zero
- Generate CSV from Array
- Get All-Time Number of MySQL Queries
- Get Current File Name
- Get FeedBurner Subscriber Count with cURL
- Get File Last Updated Date
- Get File Size
- Get Geo-IP Information
- Get Image Information
- Get Latest Twitter Status
- Get Suffix of Given Number/Date
- Get Users IP Address
- Highlight a Substring
- HTML Tidy
- Increase Maximum PHP Upload Size
- Insert Element Every nth Loop
- Intelligent PHP Cache Control
- Login Function
- Make Random Number
- MySQL Backup Class
- MySQL Database Access Class
- MySQL Restore Class
- Options to Truncate Strings
- Output Buffering
- Pagination Function
- Parse JSON
- Perform Function on Each Item of an Array
- PHP Array Contains
- PHP Date Parameters
- PHP IE Detection
- PHP Include
- PHP Redirect
- PHP Zebra Striping a Table
- POST Validation Loop
- Quick Alphabetic Navigation
- Random Hex Color
- Random Slogan Displayer
- Random String from Pre-Determined Characters
- Randomize Background Image
- Randomize File Name
- Read/Write Files
- Return Only One Variable from MySQL Query
- RSS Generator
- Sanitize Database Inputs
- Send Email
- Separate First and Last Name
- Server Side Image Resizer
- Simple Zipcode Range Tester
- Time Ago Function
- Truncate Long String Exactly In Middle
- Truncate String by Words
- Unzip Files
- Update Values of Entire Table
- URL Validation
- Variable Variables
- Zero Padded Numbers
- WordPress
- “Edit This” Button on Posts and Pages
- Admin Panel Link Only For Admins
- Automatic Social Media Links
- Base Threaded Comments Styling
- Bloginfo Shortcode
- Change Avatar Size
- Custom Database Error Page
- Custom Loop/Query Based on Custom Fields
- Customize Comments Markup
- Customize Login Page
- Disable Automatic Formatting
- Disable Automatic Formatting Using a Shortcode
- Display a Tag Cloud
- Display Author Info
- Display Post Divider In Between Posts
- Dump All Custom Fields
- Dynamic Title Tag
- Embed a Page inside a Page
- Facebook “Like” Button for WordPress
- Find ID of Top-Most Parent Page
- Get ID from Page Name
- HTML5 Shim in functions.php
- ID the Body Based on URL
- If Page Is Parent or Child
- Include Any File From Your Theme
- Include jQuery in WordPress Theme
- List Posts, Highlight Current
- Login/Logout and User Welcome
- Natural Sort Using Post meta_key
- Paginate Custom Post Types
- Prevent CSS Caching
- Prevent Search Bots from Indexing Search Results
- Recent Posts Function
- Remove Link to the WLW Manifest File
- Remove Private/Protected from Post Titles
- Remove Specific Categories From The Loop
- Remove Whitespace from Function Output
- Remove WP Generator Meta Tag
- Replace Excerpt Ellipsis with Permalink
- Reset Admin Password in Database
- Reset Admin Password Through Database
- Run a Loop Outside of WordPress
- Run Loop on Posts of Specific Category
- Shortcode for Action Button
- Shortcode in a Template
- Show Your Favorite Tweets with WordPress
- Using Custom Fields