Place square svg to the center of the screen, scale it to fit the screen's width and height with some constraints

后端 未结 6 1435
臣服心动
臣服心动 2021-02-14 14:03

It seem to be a silly question and possibly a dupe, but I couldn\'t find a good solution for a while, so finally dare to ask.

I want to place an

6条回答
  •  一整个雨季
    2021-02-14 14:41

    Have you tried adding the image as a background to your svg-container?

    .svg-container {
      height:100%;
      width:100%;
      max-height:15cm;
      max-width:15cm;
      margin: 0 auto;
      background-image:url('yourSVG.svg');
      background-repeat: no-repeat;
      background-size: contain;
    }
    

提交回复
热议问题