Skip to content

Instantly share code, notes, and snippets.

@bagerathan
Last active August 24, 2021 05:22
Show Gist options
  • Save bagerathan/4500c09ad4062fdc92b940e7add6ef11 to your computer and use it in GitHub Desktop.
Save bagerathan/4500c09ad4062fdc92b940e7add6ef11 to your computer and use it in GitHub Desktop.
[SVG in background] #css #svg
body {
background-image:
url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'><linearGradient id='gradient'><stop offset='10%' stop-color='%23F00'/><stop offset='90%' stop-color='%23fcc'/> </linearGradient><rect fill='url(%23gradient)' x='0' y='0' width='100%' height='100%'/></svg>");
}
/*
Note that the SVG content needs to be url-escaped for this to work, e.g. # gets replaced with %23.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment