Add support for wrapping image in anchor element #52

wants to merge 2 commits into


None yet

6 participants


Often these images are used as anchors, I'd like to include an automated method for generating the anchor that wraps the image.

peterbenoit added some commits Jan 25, 2013
@peterbenoit peterbenoit Update index.html
Add data-href for use in the wrapping anchor
@peterbenoit peterbenoit Update picturefill.js
Check for data-href and wrap the image

HA! I just added this to the current version I'm using. Didn't know anyone else was working on it. So therefore.. I second this motion 👍


Thanks for the PR.

Could you explain the reason you can't currently wrap an anchor around the picturefill element?

That's how it would work with a native picture element one day, I'd expect, and I think keeping features relatively in-sync with that planning is a good idea.


a can wrap anything in HTML5
the problem i foubd (thats why i forked picturefill) is when you need to add a picture inside a P, some browsers will force the div.picture outside the P, potentially breaking layout/design. span was a much better choice imho


not sure whether it qas ff/safari or fckeditor, the point is somehow div.picture was SOMETIMES out of P's


I have also run into this issue. Chrome (26.0.1410.65) and Firefox (20) will move the <div data-picture> outside of the <p>

I have had issues when a <div data-picture> is contained within an <a> within a <p>. The <img> is then moved outside of the <a>, breaking the link.

This is fixed by changing picturefill to use spans instead of divs


This is fixed with the new span markup. I believe it can be closed.

@scottjehl scottjehl closed this Jun 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment