0

I'm trying to assign mouseover rules to an svg polygon with css but i can't get it to work.

This is my svg:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="249.8125"
   height="247.1875"
   id="svg2"
   version="1.1"
   inkscape:version="0.48.4 r9939"
   sodipodi:docname="Nuovo documento 1">
  <defs id="defs4" >
      <link href="style.css" type="text/css" rel="stylesheet" 
      xmlns="http://www.w3.org/1999/xhtml"/>
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.35"
     inkscape:cx="335.6875"
     inkscape:cy="177.67353"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     inkscape:window-width="518"
     inkscape:window-height="423"
     inkscape:window-x="100"
     inkscape:window-y="100"
     inkscape:window-maximized="0" />
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Livello 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(-39.3125,-348.5625)">
    <path
       style="fill:#000000;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
       d="m 65.714286,509.50504 214.285714,-160 8.57143,91.42857 -57.14286,8.57143 0,80 L 160,520.93361 125.71429,595.21933 40,583.79075 z"
       id="path2985"
       inkscape:connector-curvature="0" />
  </g>
</svg>

This is style.css:

#path2985:hover{
    display:none;
}

In my html page, i see my svg but on mouse over it doesn't disappear.

If i open the "inspect element" tab on google chrome and i assign the :hover property to #path2985 it disappears, so i'm sure that the stylesheet is being loaded.

Why isn't the polygon disappearing on mouse over?

4

1 に答える 1

1

削除しdisplay: hidden;ます。fill-opacityホバーするまで情報を非表示にするために使用します。

<path
       style="fill:#000000;fill-opacity: 0.0;fillstroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
       d="m 65.714286,509.50504 214.285714,-160 8.57143,91.42857 -57.14286,8.57143 0,80 L 160,520.93361 125.71429,595.21933 40,583.79075 z"
       id="path2985"
       inkscape:connector-curvature="0" />

残りの詳細は、元の質問のコメント セクションにあります。

于 2013-04-15T11:09:49.000 に答える