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

Firefox rendering: stretching chevron #1256

Closed
davewhiteland opened this issue Oct 9, 2015 · 2 comments
Closed

Firefox rendering: stretching chevron #1256

davewhiteland opened this issue Oct 9, 2015 · 2 comments

Comments

@davewhiteland
Copy link
Contributor

Firefox seems to be stretching a the "click a map, over there dude" chevron oddly:

firefox-chevron

FF 41.0.1
Doesn't do this on Chrome or Safari.

@dracos
Copy link
Member

dracos commented Oct 9, 2015

The SVG is 27x33, with the background size set to 63x33 – Chrome/Safari implement this by keeping the SVG at its size and having space to the right, Firefox appears to stretch the SVG to fill the size. Dunno which is right

@zarino
Copy link
Member

zarino commented Oct 26, 2015

I think Firefox is actually doing the right thing here. You tell it to set the background image to be 63px wide, so it stretches it to be 63px wide. That's what the spec says it should do. I'm not sure why Chrome/Safari doesn't stretch it.

Anyway, all this is happening because we want to position the right edge of the arrow 46px from the right edge of the element. Which isn't possible in CSS.

You could bake that 46px into the SVG itself though, by making the SVG itself 63×33px (where the rightmost 46px are just empty). So your SVG markup would look like:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="63" height="33">
    <polygon points="0,0 13,0 26,16 13,32 0,32 13,16" fill="#ffffff"/>
</svg>

(Note width="27" has changed to width="63")

zarino added a commit that referenced this issue Oct 27, 2015
Fixes #1256 by removing the temptation for web browsers
to stretch the SVG to fill the CSS background-size box.
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

4 participants