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

后端 未结 6 1424
臣服心动
臣服心动 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 15:05

    Rather than css, you may want to try using svg's width/height, and viewBox computed via getBBox() A basic example is shown below:

    
    
    
    
    
    
      
    
    
    
    
    
    
    

提交回复
热议问题