Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find a way to avoid text gluing to images #13

Open
waldyrious opened this issue Jul 29, 2016 · 3 comments
Open

Find a way to avoid text gluing to images #13

waldyrious opened this issue Jul 29, 2016 · 3 comments

Comments

@waldyrious
Copy link
Owner

waldyrious commented Jul 29, 2016

Kind of a text-specific margin. Should not affect other layout items. I wonder if one of the possible display values could work for this.

@waldyrious waldyrious changed the title find a way to avoid text gluing to images Find a way to avoid text gluing to images Dec 11, 2016
@waldyrious
Copy link
Owner Author

Attribute selectors to the rescue?

img[align="right"] { margin-left: 1em; }
img[align="left"] { margin-right: 1em; }

waldyrious added a commit that referenced this issue Jan 19, 2018
@waldyrious
Copy link
Owner Author

waldyrious commented Feb 7, 2018

(WIP) List of pages where this can be tested:

@waldyrious
Copy link
Owner Author

waldyrious commented Apr 25, 2020

Considering that <img>'s align attribute have been deprecated for a while, and CSS-based floating recommended instead, it would be better if we didn't strip the style from images in the bookmarklet. (That may also fix the problem with SVG sharing icons that become huge in many pages.)

Once styles like float:left and float:right are preserved for images, the downstyler stylesheet should then include them in the margin ruleset. Something like this:

img[align="right"], img[style*="float:right"], img[style*="float: right"] { margin-left: 1em; }
img[align="left"],  img[style*="float:left"],  img[style*="float: left"] { margin-right: 1em; }

See also #45 for a related but probably less common construct.

@waldyrious waldyrious reopened this Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant