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

Inline SVGs in CSS are not working #15

Closed
Overbord opened this issue Mar 19, 2023 · 3 comments
Closed

Inline SVGs in CSS are not working #15

Overbord opened this issue Mar 19, 2023 · 3 comments

Comments

@Overbord
Copy link

I have an inline SVG set as a background image using CSS, but modern screenshot can't seem to 'see' it. This is a screenshot:
Screenshot 2023-03-19 at 12-17-30 Social – Nel Sandbox

And this is the generated image:
Square - This is the image

@Overbord
Copy link
Author

An example of the type of CSS I'd like to be using:

.square.blue-bubble-bottom-left {
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1080 1080"%3E%3Cpath fill="none" d="M0,657C0,438,0,219,0,0c360,0,720,0,1080,0c0,360,0,720,0,1080c-186.7,0-373.3,0-560,0c0.3-1.5,0.4-3.2,0.9-4.6 c19.7-58.2,24.6-117.7,13.7-178.2c-13.7-76.2-48.2-141.9-104.9-194.5c-90.3-83.8-196.9-113-317.7-90.1C71.9,620.2,34.8,635.9,0,657z"%3E%3C/path%3E%3Cpath fill="%23182430" d="M0,657c34.8-21.1,71.9-36.8,112-44.4c120.8-22.9,227.4,6.3,317.7,90.1C486.5,755.4,521,821,534.6,897.2 c10.9,60.5,6,119.9-13.7,178.2c-0.5,1.5-0.6,3.1-0.9,4.6c-173.2,0-346.5,0-520,0C0,939,0,798,0,657z"%3E%3C/path%3E%3C/svg%3E');
}

@qq15725
Copy link
Owner

qq15725 commented Mar 21, 2023

Playground

There doesn't seem to be any errors.

@Overbord
Copy link
Author

See sample here:

https://dev.overbord.no/sandbox/social/ - please choose Square, then Big Picture, then Bottom Left, which has the SVG in the CSS.

This is the capture code:

    jQuery('#download').click(function() {
    	jQuery('#socialcanvas').removeClass('canvas-zoom-out');
        modernScreenshot.domToJpeg(document.getElementById('socialcanvas'), { quality: 1, width:canvWidth, height:canvHeight })
        .then(dataUrl => {
        var link = document.createElement('a');
        link.download = shapetrimmed + ' - ' + fileTitle + '.jpeg';
        link.href = dataUrl;
        link.click();
        jQuery('#socialcanvas').addClass('canvas-zoom-out');
        });
    });

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

2 participants