Forum How do I...?

Graceful image handling

jwiki
In my html I am displaying images as so

<img src="/src/img.jpg" alt="img" onerror="$this.hide();"/>


Is there any way to replicate this functionality in Prince. The alt text is unsightly and I would rather not keep image info in the db.

thanks,
Jake
mikeday
You can add this CSS rule to your style sheets:
img { content: attr(src, url) }

As a result it will not use the alt attribute as a fallback if the image cannot be loaded.
jwiki
thanks, that worked. Where could I find documentation for rules like that?
mikeday
At the moment it's a bit scattered unfortunately, and often requires reference to the CSS specifications. Here is the description of attr syntax in CSS3.