How can I create a box (rect
?) that resizes itself to fit the the text inside of it using SVG?
相关问题
- Convert svg to geojson fails with ogr2ogr
- How to get coordinates of an svg?
- Changing color of SVG which was embedded using <
- Understanding svg's viewbox attribute
- Convert an inline SVG into a SVG file
相关文章
- Make marker-end same color as path?
- How to display unicode in SVG?
- Converting svg to png with inkscape command line f
- How to create an SVG Matrix without an SVG element
- rect collision detection d3js
- My background image get cut off at the bottom
- Unwanted namespaces on SVG markup when using XMLSe
- D3 grouped bar chart: How to rotate the text of x
Would the following approach make things any simpler?
and then use bbox's width and height to draw a rect?
Sorry the answer took me so long, but I was learning how to use ECMAScript with an XML DOM.
Alright. So suppose you have your document structure like so:
Adding the
<script>
tag at the bottom of the root<svg>
element causes it to execute after it's created the DOM structure above it, just like JavaScript on a web page.