Holder
======
Holder uses the `canvas` element and the data URI scheme to render image placeholders entirely in browser.
[Bootstrap](http://twitter.github.com/bootstrap/) uses Holder for thumbnails.
How to use it
-------------
Include ``holder.js`` in your HTML:
```html
```
Holder will then process all images with a specific ``src`` attribute, like this one:
```html
```
The above tag will render as a placeholder 200 pixels wide and 300 pixels tall.
To avoid console 404 errors, you can use ``data-src`` instead of ``src``.
Holder also includes support for themes, to help placeholders blend in with your layout. There are 3 default themes: ``gray``, ``industrial``, and ``social``. You can use them like this:
```html
```
Customizing themes
------------------
Themes have 4 properties: ``foreground``, ``background``, ``size``, and ``font``. The ``size`` property specifies the minimum font size for the theme. You can create a sample theme like this:
```js
Holder.add_theme("dark", {background:"#000", foreground:"#aaa", size:11, font: "Monaco"})
```
Using custom themes
-------------------
There are two ways to use custom themes with Holder:
* Include theme at runtime to render placeholders already using the theme name
* Include theme at any point and re-render placeholders that are using the theme name
The first approach is the easiest. After you include ``holder.js``, add a ``script`` tag that adds the theme you want:
```html
```
The second approach requires that you call ``run`` after you add the theme, like this:
```js
Holder.add_theme("bright", { background: "white", foreground: "gray", size: 12}).run()
```
Using custom themes and domain on specific images
-------------------------------------------------
You can use Holder in different areas on different images with custom themes:
```html
```
```js
Holder.run({
domain: "example.com",
themes: {
"simple":{
background:"#fff",
foreground:"#000",
size:12
}
},
images: "#new"
})
```
Using custom colors on specific images
--------------------------------------
Custom colors on a specific image can be specified in the ``background:foreground`` format using hex notation, like this:
```html
```
The above will render a placeholder with a black background and white text.
Custom text
-----------
You can specify custom text using the ``text:`` operator:
```html
```
If you have a group of placeholders where you'd like to use particular text, you can do so by adding a ``text`` property to the theme:
```js
Holder.add_theme("thumbnail", { background: "#fff", text: "Thumbnail" })
```
Fluid placeholders
------------------
Specifying a dimension in percentages creates a fluid placeholder that responds to media queries.
```html
```
By default, the fluid placeholder will show its current size in pixels.
Automatically sized placeholders
--------------------------------
If you'd like to avoid Holder enforcing an image size, use the ``auto`` flag like so:
```html
```
The above will render a placeholder without any embedded CSS for height or width.
Background placeholders
-----------------------
Holder can render placeholders as background images for elements with the `holderjs` class, like this:
```css
#sample {background:url(?holder.js/200x200/social) no-repeat}
```
```html