Code Monkey home page Code Monkey logo

picturefill's Introduction

Picturefill

A responsive image polyfill.

  • Authors: Scott Jehl, Mat Marquis, Shawn Jansepar (2.0 refactor lead), and many more: see Authors.txt
  • License: MIT

build-status Join Slack channel

Picturefill has three versions:

  • Version 2 (recommended) is a strict polyfill of the Picture element draft specification and is the main version in development.
  • Version 1 mimics the Picture element pattern with span elements. It is maintained in the 1.2 branch.

Usage, Demos, Docs

To find out how to use Picturefill on your sites, visit the project and demo site:

Picturefill Documentation, Downloads, and Demos Site

The gotchas

Be it browsers, the picture spec, or picturefill, there are a couple gotchas you should be aware of when working with Picturefill.

  • Firefox 38 and 39 has some bugs [1] [2] [3] where images won't update on screen resize. These should be fixed in Firefox 40.

  • Per the picture spec, using % isn't allowed in the sizes attribute. Using % will fallback to 100vw.

  • Trying to use the src attribute in a browser that doesn't support picture natively can result in a double download. To avoid this, don't use the src attribute on the img tag:

<picture>
    <source srcset="../img/sample.svg" media="(min-width: 768px)" />
    <img srcset="default.png" alt="Sample pic" />
</picture>
  • If you only want to have an image show up at certain sizes, and not show up at others, you will need to use a transparent placeholder gif:
<picture>
    <source srcset="../img/sample.svg" media="(min-width: 768px)" />
    <img srcset="data:image/gifbase64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
        alt="Sample pic" />
</picture>

Contributing

For information on how to contribute code to Picturefill, check out CONTRIBUTING.md

Issues

If you find a bug in Picturefill, please add it to the issue tracker

Discussion

Picturefill discussion takes place via Slack. For an invitation, visit https://pf-slackin.herokuapp.com/

Support

Picturefill supports a broad range of browsers and devices (there are currently no known unsupported browsers), provided that you stick with the markup conventions provided.

picturefill's People

Contributors

wilto avatar scottjehl avatar jansepar avatar johnbender avatar mike-engel avatar gbokiau avatar nschonni avatar jefflembeck avatar zcorpan avatar attiks avatar jonathantneal avatar andreruffert avatar davebeesleyarchived avatar fgnass avatar bruceontheloose avatar cbieser avatar jcutrell avatar saranrapjs avatar gordonbrander avatar ruffle1986 avatar rainbowarray avatar floriangouy avatar commadelimited avatar wturrell avatar tylerball avatar tinacious avatar petergok avatar peterdavehello avatar pborreli avatar michaelgilley avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.