Positioning SVG elements using CSS

后端 未结 7 1912
野性不改
野性不改 2020-12-29 01:14

Assume the following svg document:




        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 02:04

    Use css positioning:

    index.html

    
    
    My text

    style.css

    .parent {
      position: relative;
      height: 1000; /* bigger than your svg */
      width: 1000; /* bigger than your svg */
    }
    
    .child {
      position: absolute;
      top: 10px;  /* relative to parent container */
      left: 10px; /* relative to parent container */
    }
    

提交回复
热议问题