---
title: "Discussion on \"Why SVG Icons Render at the Wrong Size: viewBox, width/height, and CSS\" | Hashnode"
description: "Discussion on \"Why SVG Icons Render at the Wrong Size: viewBox, width/height, and CSS\". Why Figma SVGs look the wrong size: viewBox is the contract, width/height are defaults, CSS/props set size. Retina PNG math + a 60s audit."
url: "https://hashnode.com/posts/svg-viewbox-vs-width-height-css/6a7a54e6b268deffb3e881b4"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why SVG Icons Render at the Wrong Size: viewBox, width/height, and CSS](https://roman-riaboshtan.hashnode.dev/svg-viewbox-vs-width-height-css?utm_source=hashnode&utm_medium=feed)

Why Figma SVGs look the wrong size: viewBox is the contract, width/height are defaults, CSS/props set size. Retina PNG math + a 60s audit.

Aug 10 · 14 min read · roman-riaboshtan.hashnode.dev  
Updated Aug 25  
Read the article

-   [#svg](https://hashnode.com/tag/svg)
-   [#react](https://hashnode.com/tag/react)
-   [#css](https://hashnode.com/tag/css)
-   [#webdev](https://hashnode.com/tag/webdev)
-   [#frontend](https://hashnode.com/tag/frontend)

## Written by

[Roman Riaboshtan](https://hashnode.com/@roman-riaboshtan)

@roman-riaboshtan · Ukraine

  
[View profile](https://hashnode.com/@roman-riaboshtan)

Growing getsvgeditor.com | Full-Stack Developer | Python & React

Maintaining and growing getsvgeditor.com. Full-stack developer writing about Python, React, and SVG tooling.

## Responses 3

Markdown supported · ⌘↵ to post

[Tarun Sharma](https://hashnode.com/@101beardo)

[Aug 18](https://hashnode.com/posts/svg-viewbox-vs-width-height-css/6a7a54e6b268deffb3e881b4/comment/6a8408abad1bb772c084b262)

The {...props} order bug is the one I've seen bite teams the most, especially once a design system wraps every icon in its own component and nobody remembers to check spread order six months later. I'd add one more trap to your edge case list: a global .icon { width: 24px !important } left over from an old reset will beat both the size prop and correct spread order, and it looks exactly like a broken component so people go debugging JSX for an hour before checking the stylesheet. Worth grepping for !important on icon classes before blaming the component.

[Roman Riaboshtan](https://hashnode.com/@roman-riaboshtan)

[Aug 18](https://hashnode.com/posts/svg-viewbox-vs-width-height-css/6a7a54e6b268deffb3e881b4/comment/6a8408abad1bb772c084b262#reply-6a840a2fb7d0461a0ee9249d)

Thanks for reading and for the great tip! I’ll definitely look into adding this edge case to the article. Also, really appreciate you sharing that real-world issue from your project — awesome feedback!

[Tarun Sharma](https://hashnode.com/@101beardo)

[Aug 18](https://hashnode.com/posts/svg-viewbox-vs-width-height-css/6a7a54e6b268deffb3e881b4/comment/6a8408abad1bb772c084b262#reply-6a84342c0b6468e4b90c9e0a)

Glad it's useful. That !important trap is easy to miss since the symptom looks exactly like a broken component, not a stylesheet issue, so it's worth calling out explicitly.
