A fresh mix of code snippets and tutorials

Category Archive: HTML

Posts about HTML

Page 1 of 2

Disable manual resizing with meta viewport

Just a quick snippet for telling the browser to disable manual resizing of the page. You can see this technique in use here at WP-Mix as well as most of my other websites. If you view the source code of any web page on the site, you can see the meta viewport tag in effect […]

Fix double abbr underlines

The developers at Firefox decided to add their own default styles for <abbr></abbr> and <acronym></acronym> tags — completely ignoring the fact that many sites already include their own styles for abbreviations and acronyms. The result is an ugly double underline and/or text-decoration in Firefox browsers.

Disable caching with HTML

If you can’t use .htaccess to disable caching at the server-level, here is an alternate HTML-only method that disables Cache-Control, Pragma, and Expires headers via <meta /> tags.

jQuery Auto Resize Multiple Textareas

The User Notes Widget that’s included in my Dashboard Widgets Suite plugin enables users to edit notes right on the WP Dashboard. To make things extra awesome, each note automatically expands as the user types more lines of text. This post explains how I achieved this trick, aka multiple auto-resize textareas.

Replace contenteditable with textarea

Working on my WordPress plugin, Dashboard Widgets Suite, I needed a solid way of replacing contenteditable with a textarea on form submit. Here is a simple solution along with some bonus notes on dealing with certain HTML tags.

WordPress Basic Allowed HTML for wp_kses

Here is a function that I use in my plugin, Dashboard Widgets Suite. It provides a sane, practical set of HTML tags and attributes for WP’s wp_kses family of functions.

Add Facebook OG Attributes to HTML Tag

When adding Facebook Open Graph (OG) tags to your web pages, it is a good idea to add the required attributes to the <html></html> tag. Here is one way of doing it.

Disable Pinterest on Your Pages

Pinterest is a social-media service that people can use to collect your site’s images. The Pinterest browser extension and app add a “Pin it” (or whatever) button to the images that are included on your web pages. That way users can just click a button to add your images to their account on Pinterest. Fortunately, […]

Share links without sending referrer information

Here is a quick tip for sending links without including any referrer information. I found this service used at WordPress.com.

Specify images for web pages

This is a general technique for specifying an official image for your site, without actually displaying it on the front-end. Useful for catch-all social-media purposes.

Display a Simple “Tweet This” Link

Twitter changes their API quite a bit, however it is still possible to display a simple “tweet this” link anywhere on your web pages.

Basic Code for Image Slider

Here is the basic code required for making a simple image slider. It provides a good starting point for rolling your own sliders, carousels, and so forth.