Materialdesign: Resizing

Created on 30 Nov 2017  路  5Comments  路  Source: Templarian/MaterialDesign

Hi,

is it possible to resize the icons??

Question

Most helpful comment

Just maintain the `viewBox="0 0 24 24" and then either with CSS or inline attributes, set the width and height.

<svg width="48" height="48" viewBox="0 0 24 24">
  <path d="M19.78,11.78L18.36,13.19L12,6.83L5.64,13.19L4.22,11.78L12,4L19.78,11.78Z"/>
</svg>

OR

svg {
  width: 2rem;
  height: 2rem;
}
<svg viewBox="0 0 24 24">
  <path d="M19.78,11.78L18.36,13.19L12,6.83L5.64,13.19L4.22,11.78L12,4L19.78,11.78Z"/>
</svg>

All 5 comments

Yes.

(Can't provide more detail than that without more detail from you! 馃槅 What format are you asking about? Webfont, SVG, PNG, something else?)

SVG :)

Just maintain the `viewBox="0 0 24 24" and then either with CSS or inline attributes, set the width and height.

<svg width="48" height="48" viewBox="0 0 24 24">
  <path d="M19.78,11.78L18.36,13.19L12,6.83L5.64,13.19L4.22,11.78L12,4L19.78,11.78Z"/>
</svg>

OR

svg {
  width: 2rem;
  height: 2rem;
}
<svg viewBox="0 0 24 24">
  <path d="M19.78,11.78L18.36,13.19L12,6.83L5.64,13.19L4.22,11.78L12,4L19.78,11.78Z"/>
</svg>

Thank you !

@AndreaRylander, just as an FYI, I typically use both methods. That's because the inline attribute converts to pixels. Without setting the inline attributes there is a rendering glitch. The SVG appears large because the HTML has rendered and the icon will be huge until the CSS is rendered. I also only work with rems and ems because of accessibility, and because of that, the inline attributes won't work properly for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xaviergonz picture xaviergonz  路  3Comments

bckp1993 picture bckp1993  路  3Comments

vishnu1991 picture vishnu1991  路  3Comments

JackDrakkar picture JackDrakkar  路  3Comments

puytr picture puytr  路  3Comments