-
Notifications
You must be signed in to change notification settings - Fork 0
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
Behavior different then docs #1
Comments
I forked the fiddle: https://jsfiddle.net/Qomponents/rvaj9n14/ Lit... I loath it, IconMeister uses standard JS getProperty code, so if CSS config doesn't work it is most likely because the DOM isn't ready yet. If you can create an example on https://webcomponents.dev (it has a Lit starter) I can see what happens |
In your fiddle take one of the icons out of the icon-toolbar and see what I mean. The css is applied to svg-icon so the w and h should just work right ... |
See: https://jsfiddle.net/Qomponents/rvaj9n14/ Every icon has its own A CSS definition svg-icon {
--svg-icon-w: 22;
--svg-icon-h: 22;
} overrules this, and sets a
You can't do Altering viewBox width/height is for advanced users. Icon widthSee: https://jsfiddle.net/Qomponents/rvaj9n14/ The icon Icons by default take 100% of the container element width. To set a width/height use regular CSS: svg-icon[is="menu"] {
width: 80px;
height: 80px;
} |
Thanks, that is very helpful. Although, If I load your fiddle and remove the icon-toolbar tags and hit run, all the icons blow up to really big size. They seem to ignore the sizing from css. I can't figure out what they are inheriting from icon-toolbar css that makes the difference. Do you get that same behavior? |
Yes, that is CSS at "its best" if you remove the container, icons will still take up 100% if the first parent container block element; You can make <svg-icon> a block element by setting the display property to (I added the CSS property <style>
svg-icon {
display: inline-block; /* with block the element will behave like a DIV */
background: grey;
--size: 60px;
width: var(--size);
height: var(--size);
}
</style>
<svg-icon is="menu"></svg-icon>
<svg-icon is="settings"></svg-icon>
<svg-icon is="refresh" fill=blue></svg-icon>
<svg-icon is="bold" stroke=green></svg-icon>
<svg-icon is="pointright" rotate=90></svg-icon> There are always different solutions: https://www.impressivewebs.com/width-100-percent-css/ |
Hi, Thanks for providing this, I find it very useful. Just want to share some experiences. I have confirmed the below on your jsFiddle
When I follow the example and use w=16 h=16 I get a full sized icon. It only seems to work if I user w='16px' h='16px' but even then it only effects the icon not the rectangle (eg big white space)
I tried using CSS,but it didn't work. I tried both
.icon{
--svg-icon-w: 16px;
--svg-icon-h: 16px;
and
--svg-icon-width: 16px;
--svg-icon-height: 16px;
}
Actually I have not been able to set any properties with CSS.
I am using svg-icon in a native web-component environment with lit-html for rendering templates.
The text was updated successfully, but these errors were encountered: