A fresh mix of code snippets and tutorials

Category Archive: CSS

Posts about CSS

Page 3 of 4

Tip for resizing images

Here is a quick tip for getting clearer images when reducing their size at web resolution 72dpi.

WordPress enqueue user-agent stylesheets

WordPress makes it clean and easy to enqueue custom stylesheets via the functions.php file. Here’s how to do it for user-agent stylesheets.

PHP Compress CSS & JavaScript

Quick snippets for compressing CSS and JavaScript with PHP’s ob_gzhandler, which will gzip or deflate content depending on browser support.

CSS transition effect for links

CSS transitions can add a nice effect to links. Here are some quick example snippets for your copy/paste enjoyment.

Automatic versioning for enqueued stylesheets

Learn how to append the theme version, random number, or both as a query-string parameter to your CSS stylesheet URLs. This is useful for automatic versioning, cache-busting during development, or both.

CSS content for list items

Quick snippet for replacing default list-style types (bullets, discs, squares, etc.) with custom generated content in CSS.

Tabbed sidebar menu with jQuery

Here’s an clean, simple way to add a tabbed sidebar menu using jQuery. You can see an example in the Introspection WP Theme.

Google Translate in 2 Steps

Follow this simple two-step tutorial to enable users to translate your web pages into many different languages. Great way to increase exposure and traffic.

Targeting different versions of IE

Honestly I can’t stand Internet Explorer. But people still use it, so here’s a few ways (via jQuery & CSS) to target different versions of IE.

Shorten text with CSS

There are several ways to shorten text, depending on the situation and goals. It’s preferable in most cases to shorten text server-side via PHP, but also possible to shorten via jQuery or even CSS.

Combine & compress CSS files with PHP

Here is another technique for combining multiple CSS stylesheets into a single, compressed file.

Combine all CSS files with PHP

Here is a simple PHP script that will combine all CSS files (stylesheets) in a given directory. Delivering one CSS file with your web pages is much faster than delivering multiple files because there are fewer HTTP requests involved.