How to make area be irregular shape not rectangle?

前端 未结 1 863
渐次进展
渐次进展 2021-01-24 09:06

How to make area be irregular shape not rectangle? I used svg code like below, tried to make a map but I just can\'t get it how to make mouse over or click the area not rectangl

相关标签:
1条回答
  • 2021-01-24 09:40

    You can use pure CSS to achieve the results you are looking for. Add an id/class to your svg, in this case I added an id of poly1.

    Here is your svg modified JSFiddle: >>>CLICK HERE<<<

    SVG:

    <svg version="1.1" class="flag_link_0" xmlns="http://www.w3.org/2000/svg"  mlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="190.323px" height="325.806px" viewBox="0 0 190.323 325.806" enable-background="new 0 0 190.323 325.806" xml:space="preserve">
        <polygon fill="#A71F20" stroke="#A71F20" stroke-width="3px" id="poly1" points="10.839,314.677 181.839,314.677 181.839,48.186 10.839,9.677 " />
    

    CSS:

    #poly1:hover {
        fill: #ccc;
        stroke: #A71F20;
        stroke-width: 3px;
    }
    
    0 讨论(0)
提交回复
热议问题