Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React & SVG max width

I want to use max-width in a React component. I tried both max-width and maxWidth attributes , but it looks like that it's omitted from the element when I inspect it. (When I put it in the CSS it works.)

like image 500
Arian Avatar asked Apr 13 '15 21:04

Arian


2 Answers

You need to use the style attribute. See Inline Styles.

<div style={{ maxWidth: 250 }}></div>
like image 187
Alexandre Kirszenberg Avatar answered Oct 13 '22 22:10

Alexandre Kirszenberg


You must have copied the code from somewhere else so, please check the if there is ";" semicolon inside inline styling, because react doesn't support that. Use syntax like the following:

<div style={{maxWidth: "100px"}}></div>
like image 36
naresh Purushotham Avatar answered Oct 13 '22 22:10

naresh Purushotham