Remove Scrollbar from Textarea in IE

By default all versions of IE have a scrollbar on textareas, even when they are empty.

No other browsers do this, so if you want to remove it so IE can visually match other browsers, just:

textarea { overflow: auto; 
Avatar of Chris Coyier
Chris Coyier on

#82: CSS Image Switcher

Roll over a link, watch the image above change. That’s what we build in this screencast, only we don’t use any JavaScript to do it. The trick is some simple z-index switching on hover and a bit of absolute positioning.…

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Sanitize Database Inputs

1) Function for stripping out malicious bits
<?php
function cleanInput($input) {
 
  $search = array(
    '@<script[^>]*?>.*?</script>@si',   // Strip out javascript
    '@<[\/\!]*?[^<>]*?>@si',            // Strip out HTML tags
    '@<style[^>]*?>.*?</style>@siU',    // Strip style tags properly
    '@<![\s\S]*?--[ \t\n\r]*>@'         // Strip multi-line comments
  );
 
    $output = 
Avatar of Chris Coyier
Chris Coyier on

POST Validation Loop

Assumptions

You have an HTML form with a variety of inputs. The action attribute of the form points to a PHP file that contains the code below.

Notes about code

This code starts by creating an array that holds the …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Set iPhone Bookmark Icon

Place this in your <headsection, and set the href attribute to an image to a 57px x 57px PNG file.

<link rel="apple-touch-icon" href="iphone-icon.png"/>

To prevent the iPhone from adding it’s own gloss:

<link rel="apple-touch-icon-precomposed" href="icon" />
Avatar of Chris Coyier
Chris Coyier on (Updated on )

Find all Internal Links

Find all links that start with the sites domain, a slash, relative file path, or a hashtag.

var siteURL = "http://" + top.location.host.toString();

var $internalLinks = $("a[href^='"+siteURL+"'], a[href^='/'], a[href^='./'], a[href^='../'], a[href^='#']");
Avatar of Chris Coyier
Chris Coyier on