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

there is a much better way to handle this without having to rely on fixed height/width #25

Open
dagadbm opened this issue Jul 22, 2020 · 1 comment

Comments

@dagadbm
Copy link

dagadbm commented Jul 22, 2020

Just add a before pseudo element to the div you want to add the image and do content: url(mySvg);

@dagadbm
Copy link
Author

dagadbm commented Jul 22, 2020

example

	.warn-icon {
		&::before {
			content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath fill='%23FFA000' d='M10 0c5.514 0 10 4.486 10 10s-4.486 10-10 10S0 15.514 0 10 4.486 0 10 0zm0 1.25c-4.825 0-8.75 3.925-8.75 8.75s3.925 8.75 8.75 8.75 8.75-3.925 8.75-8.75S14.825 1.25 10 1.25zm0 11.875A.938.938 0 1110 15a.938.938 0 010-1.875zm0-9.375c.345 0 .625.28.625.625v6.875a.625.625 0 01-1.25 0V4.375c0-.345.28-.625.625-.625z'/%3E%3C/svg%3E");
		}
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant