You really have not provided enough information. For example, what is the parent of your SVG?
Just because your <rect> has a width and a height does not mean what your SVG does. SVG is not like HTML, where elements expand to fit their children. SVG is similar to the <canvas> . You must make sure that it explicitly (or implicitly) has a size.
You did not specify width and height attributes for your <svg> element, so both defaults are set to "100%". The fact that they are 100% dependent on what size is the parent element of the SVG. Hence my first question above.
source share