waldyrious / downstyler

A stylesheet and bookmarklet that trims webpage styles down to near-bare HTML.
http://waldyrious.net/downstyler
ISC License
30 stars 5 forks source link

Float images and figures with class containing "right" or "left" #45

Open waldyrious opened 6 years ago

waldyrious commented 6 years ago

CSS has been recommended as an alternative to align attributes in img tags for a while now, so it would make sense to recognize (heuristically) cases where such styles have been applied.

This would imply changing the rule added in #40.

waldyrious commented 6 years ago

This will probably be a little tricky if we want to include figures. For example:

<figure class="alignright">
  <img src="https://example.net/foo.jpg" width="100" height="200"/>
  <figcaption>Lorem ipsum</figcaption>
<figure>

...would probably require styling along the lines of:

figure[class *= "right"] { max-width: 50%; float: right; margin: 0; }
/* For images with width attributes: */
figure[class *= "right"] img[width] { width: 100%; height: auto; }