I would like to know how to read a value of a property in a css class from svg using javascript.
Specifically, I would like to retrieve the font-size of the text element in the following example.
This example includes two files: svg file, and a css file that the svg file refers to.
Thanks,
vn1977
//*********************svg file*******************************
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" standalone="no"?>
- <?xml-stylesheet href="commonMap.css" type="text/css"?>
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
- <svg id="mainMap" width="950" height="475"
- viewBox="-82.049332 -30.5758 0.667485000000013 0.471659000000002"
- xmlns:xlink="http://www.w3.org/1999/xlink">
- <script language="text/ecmascript" >
- <![CDATA[
- ]]>
- </script>
- <text x="="-81.9332 " y="-30.2758"
- class ="FreewayText" >
- Hello, out there
- </text>
- </svg>
================================================== =
//*****************commonMap.css file***************************************
Expand|Select|Wrap|Line Numbers
- *.FreewayText
- {
- text-anchor: middle;
- font-family:Verdana;
- font-size: 0.001;
- color: black;
- }