更改svg标题位置和字体大小

时间:2017-01-24 19:10:42

标签: css svg tooltip title

我正在使用SVG标题标签为多个svg元素(recs,polygons等)创建工具提示。 但是,title元素会创建一个小工具提示,它被鼠标光标覆盖一半。 我试图使用CSS来改变标题字体大小,但无济于事。我已经搜索了创建工具提示的其他方法,但它们涉及更改我的svg的基本布局(为我的地图上的每个元素创建多个g元素)。 有没有办法编辑标题样式?

谢谢。

这是完整的html文件(不包括基本图层地图,因为它包含太多要显示的字符,无论如何都无法编辑):

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <style>
        .copier:hover
{
    fill:rgb(32, 43, 228);
    fill-opacity:0.7;
    pointer-events:all;
}

        .copier
{
    fill:rgb(32, 43, 228);
    fill-opacity:0.4;
    pointer-events:all;
}

.area:hover
{
    fill:rgb(46, 221, 167);
    fill-opacity:0.7;
    pointer-events:all;
}

.area
{
    fill:rgb(46, 221, 167);
    fill-opacity:0.4;
    pointer-events:all;
}

.desk:hover
{
    fill:rgb(29, 255, 0);
    fill-opacity:0.6;
    pointer-events:all;
}

.desk
{
    fill:rgb(29, 255, 0);
    fill-opacity:0.4;
    pointer-events:all;
}

.redbooks:hover
{
    fill:rgb(255, 0, 0);
    fill-opacity:0.7;
    pointer-events:all;
}

.redbooks
{
    fill:rgb(255, 0, 0);
    fill-opacity:0.4;
    pointer-events:all;
}

.books:hover
{
    fill:rgb(150, 40, 177);
    fill-opacity:0.7;
    pointer-events:all;
}

.books
{
    fill:rgb(150, 40, 177);
    fill-opacity:0.4;
    pointer-events:all;
}

#_x32_1-22_open_university:hover
{
    fill:rgb(235, 255, 0);
    fill-opacity:0.7;
    pointer-events:all;
}

#_x32_1-22_open_university
{
    fill:rgb(235, 255, 0);
    fill-opacity:0.4;
    pointer-events:all;
}

#_x32_1-_reading_literature:hover
{
    fill:rgb(34, 213, 194);
    fill-opacity:0.7;
    pointer-events:all;
}

#_x32_1-_reading_literature
{
    fill:rgb(34, 213, 194);
    fill-opacity:0.4;
    pointer-events:all;
}

#_x32_0_-_textbooks:hover
{
    fill:rgb(128, 128, 128);
    fill-opacity:0.7;
    pointer-events:all;
}

#_x32_0_-_textbooks
{
    fill:rgb(128, 128, 128);
    fill-opacity:0.4;
    pointer-events:all;
}

.services:hover
{
    fill:rgb(110, 121, 246);
    fill-opacity:0.7;
    pointer-events:all;
}

.services
{
    fill:rgb(110, 121, 246);
    fill-opacity:0.4;
    pointer-events:all;
}

.door:hover
{
    fill:rgb(84, 144, 189);
    fill-opacity:0.7;
    pointer-events:all;
}

.door
{
    fill:rgb(84, 144, 189);
    fill-opacity:0.4;
    pointer-events:all;
}

/*Tooltip styles*/
.tooltip
{
    font-weight:700;
    font-size:22pt;
}
    </style>
</head>
<body>
    <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="612px"
         height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">
        <g id="map">...</g>
        <g id="Borders">
            <polygon class="area" id="Silent_Room" fill="none" stroke="#000000" stroke-miterlimit="10" points="165.667,100.836 181.015,91.659
                190.333,83.67 283.455,108.836 283.455,196.781 269.167,203.003 269.167,223.17 143.5,223.17 143.333,106.17 151.833,105.003">
                <title>חדר שקט</title>
            </polygon>
            <polygon class="copier" id="Copier1" fill="none" stroke="#000000" stroke-miterlimit="10" points="226.667,239.668 226.667,226.668 202,226.668
                202,239.333">
                <title>מדפסות 1 ו-2</title>
            </polygon>
            <polygon class="copier" id="Copier_2" fill="none" stroke="#000000" stroke-miterlimit="10" points="252.167,226.668 228.167,226.668
                227.833,239.668 252.167,239.333">
                <title>מכונת צילום</title>
            </polygon>
            <polyline class="books" id="_x32_1-22_open_university" fill="none" stroke="#000000" stroke-miterlimit="10" points="192.842,261.333
                192.842,264.833 248.917,264.833 248.917,268.333 276.583,268.333 276.583,261.333 192.083,261.167">
                <title>21-22: אוסף האוניברסיטה הפתוחה</title>
            </polyline>
            <rect class="books" id="_x32_1-_reading_literature" x="192.083" y="265.167" fill="none" stroke="#000000" stroke-miterlimit="10" width="56.833" height="2.833">
                <title>21: ספרות יפה</title>
            </rect>
            <polygon class="books" id="_x32_0_-_textbooks" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.667,283.5 262.5,283.5
                263.167,287.167 277,287.167 277,279.833 192.592,279.585 191.667,279.833">
                <title>19-20: Textbooks</title>
            </polygon>
            <polygon class="books" id="_x31_9_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="262.5,287.167 262.5,283.5
                191.667,283.5 192.592,287.167">
                <title>19: 681.31.06 מיצ'-סוף</title>
            </polygon>
            <polygon class="books" id="_x31_8_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="277,301.496 277,297.83 191.667,297.83 192.129,301.496   " >
                <title>18: 658.626-681.31.06 מדע</title>
            </polygon>
            <polygon class="books" id="_x31_7_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="277,305.163 277,301.497 191.667,301.497 192.129,305.163     " >
                <title>17: 658:577.4-658.58</title>
            </polygon>
            <polygon class="books" id="_x31_6_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="277,319.667 277,316 191.667,316 192.129,319.667     " >
                <title>16: 65.012.4-658</title>
            </polygon>
            <polygon class="books" id="_x31_5_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="277,324 277,320.333 191.667,320.333 192.129,324     " >
                <title>15: 65.01 Cap-65.012.32</title>
            </polygon>
            <polygon class="books" id="_x31_4_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="277,338.167 277,334.5 191.667,334.5 192.129,338.167     " >
                <title>14: 63.001.5-65.01 Bro</title>
            </polygon>
            <polygon class="books" id="_x31_3_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="277,341.833 277,338.167 191.667,338.167 192.129,341.833     " >
                <title>13: 621.382 Dan-63(9)(091)</title>
            </polygon>
            <polygon class="books" id="_x31_2_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="277,356.667 277,353 191.667,353 192.129,356.667     " >
                <title>12: 62-621.382 Cro</title>
            </polygon>
            <polygon class="books" id="_x31_1_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="277,360.333 277,356.667 191.667,356.667 192.129,360.333     " >
                <title>11: 591-618</title>
            </polygon>
            <polygon class="desk" id="Computer_Desk_1" fill="none" stroke="#000000" stroke-miterlimit="10" points="166.167,257.663 166.167,238.329 144.667,237.829 144.667,257.663  " >
                <title>שולחן מחשב</title>
            </polygon>
            <polygon class="desk" id="Computer_Desk_2" fill="none" stroke="#000000" stroke-miterlimit="10" points="166.167,297.083 166.167,277.75 144.667,277.25 144.667,297.083    " >
                <title>שולחן מחשב</title>
            </polygon>
            <polygon class="desk" id="Computer_Desk_3" fill="none" stroke="#000000" stroke-miterlimit="10" points="166.167,336.333 166.167,317 144.667,316.5 144.667,336.333    " >
                <title>שולחן מחשב</title>
            </polygon>
            <polygon class="desk" id="Computer_Desk_4" fill="none" stroke="#000000" stroke-miterlimit="10" points="166.167,376.5 166.167,357.167 144.667,356.667 144.667,376.5  " >
                <title>שולחן מחשב</title>
            </polygon>
            <polygon class="desk" id="Computer_Desk_5" fill="none" stroke="#000000" stroke-miterlimit="10" points="166.167,415.834 166.167,396.5 144.667,396 144.667,415.834    " >
                <title>שולחן מחשב</title>
            </polygon>
            <polygon class="books" id="_x31_0_-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.833,473.811 276.667,473.311 276.667,476.977 191.833,477.977     " >
                <title>10: 517 גוב-539.2</title>
            </polygon>
            <polygon class="books" id="_x39__-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.833,477.477 276.667,476.977 276.667,480.643 191.833,481.643  " >
                <title>9: 37.018.43-517 איי</title>
            </polygon>
            <polygon class="books" id="_x38__-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.833,491.978 276.667,491.478 276.667,495.144 191.833,496.144  " >
                <title>8: 338.982-37.018.26</title>
            </polygon>
            <polygon class="books" id="_x37__-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.833,495.644 276.667,495.144 276.667,498.81 191.833,499.81    " >
                <title>7: 333.013(73)-338.982</title>
            </polygon>
            <polygon class="books" id="_x36__-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.833,510.686 276.667,510.186 276.667,513.852 191.833,514.852  " >
                <title>6: 327-333(100)</title>
            </polygon>
            <polygon class="books" id="_x35__-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.833,513.269 276.667,512.769 276.667,516.435 191.833,517.435  " >
                <title>5: 301.16-326.1</title>
            </polygon>
            <polygon class="books" id="_x34__-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.833,529.046 276.667,528.546 276.667,532.212 191.833,533.212  " >
                <title>4: 159.953-301.154.12</title>
            </polygon>
            <polygon class="books" id="_x33__-_collection" fill="none" stroke="#000000" stroke-miterlimit="10" points="191.833,532.962 276.667,532.462 276.667,536.128 191.833,537.128  " >
                <title>3: 001.4-159.95</title>
            </polygon>
            <rect class="books" id="_x32__-_collection" x="191.833" y="547.48" fill="none" stroke="#000000" stroke-miterlimit="10" width="56.5" height="3.167" >
                <title>2: פרויקטים - הנדסאים</title>
            </rect>
            <rect class="books" id="_x31__-_collection" x="191.833" y="551.333" fill="none" stroke="#000000" stroke-miterlimit="10" width="56.5" height="3.167" >
                <title>1: 7(091)-796.4, קופסאות קיבוץ</title>
            </rect>
            <rect class="desk" id="Accessibility_Computer" x="319.25" y="509.125" fill="none" stroke="#000000" stroke-miterlimit="10" width="11.75" height="10.5" >
                <title>מחשב נגישות</title>
            </rect>
            <rect class="desk" id="Clinical_Psycology" x="319.25" y="496.977" fill="none" stroke="#000000" stroke-miterlimit="10" width="11.75" height="10.5" >
                <title>מחשב פסיכולוגיה קלינית</title>
            </rect>
            <rect class="services" id="Yaatz" x="319.25" y="468.612" fill="none" stroke="#000000" stroke-miterlimit="10" width="21.333" height="19.833" >
                <title>עמדת יעץ</title>
            </rect>
            <polygon class="services" id="Hashala" fill="none" stroke="#000000" stroke-miterlimit="10" points="429.666,469.945 384.666,469.945 384.416,456.112 430.082,456.112  " >
                <title>דלפק השאלה</title>
            </polygon>
            <rect class="redbooks" id="_x33_2_-_red" x="416.416" y="514.684" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>32: 001.81-35(9) שמורים</title>
            </rect>
            <rect class="redbooks" id="_x33_1_-_red" x="416.416" y="519.017" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>31: 352-65.012.2 שמורים</title>
            </rect>
            <rect class="redbooks" id="_x33_0-red_x2F_Seminars" x="416.416" y="534.601" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>30: 65.012.3-940.2 שמורים, עבודות סמינריוניות</title>
            </rect>
            <rect class="redbooks" id="_x32_9_-_syllabuses" x="416.416" y="538.684" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>29: מקראות</title>
            </rect>
            <rect class="redbooks" id="_x32_8_-_Jounala_articles_Ethiopia" x="416.416" y="554.517" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>28: עיתונות עליית יהודי אתיופיה</title>
            </rect>
            <rect class="redbooks" id="_x32_7_-_syllabuses" x="416.416" y="558.434" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>27: מקראות</title>
            </rect>
            <rect class="redbooks" id="_x32_6_-_dictionaries" x="416.416" y="574.414" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>26: R621.7(02)-R933.44 יעץ</title>
            </rect>
            <rect class="redbooks" id="_x32_5_-_dictionaries" x="416.416" y="578.831" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>25: R3(05)(9)-R621.7 יעץ</title>
            </rect>
            <rect class="redbooks" id="_x32_4_-_dictionaries" x="416.416" y="594.101" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>24: R03=20-R221(048) יעץ</title>
            </rect>
            <rect class="redbooks" id="_x32_3_-_dictionaries" x="416.416" y="598.518" fill="none" stroke="#000000" stroke-miterlimit="10" width="41.75" height="4.416" >
                <title>23: R000.81-R03:933.44 יעץ</title>
            </rect>
            <polygon class="area" id="Stairs_Down" fill="none" stroke="#000000" stroke-miterlimit="10" points="444.667,366.5 444.667,235.833 419.667,235.667 419.667,366.5  " >
                <title>מדרגות לקומת קרקע</title>
            </polygon>
            <polyline class="area" id="Staff_Offices" fill="none" stroke="#000000" stroke-miterlimit="10" points="314.168,523.434 314.168,698.499 414.5,698.499 414.5,496.144 362.835,496.144
                362.835,521.226 314.168,521.226     " >
                <title>משרדים</title>
            </polyline>
            <polyline class="desk" id="Guard_Post" fill="none" stroke="#000000" stroke-miterlimit="10" points="444.667,196.781 425,196.781 425,220 444.667,220 444.667,195.5    " >
                <title>עמדת שומר</title>
            </polyline>
            <polyline class="door" id="Main_Entrance" fill="none" stroke="#000000" stroke-miterlimit="10" points="448.25,192.5 448.25,195.5 479.25,195.5 479.25,192.5 446.751,192.5     " >
                <title>דלת כניסה</title>
            </polyline>
            <polyline class="door" id="Emergency_Exit" fill="none" stroke="#000000" stroke-miterlimit="10" points="283,161.67 283,164.67 314,164.67 314,161.67 281.501,161.67   " >
                <title>יציאת חירום</title>
            </polyline>
            <polyline class="door" id="Emergency_Exit_1_" fill="none" stroke="#000000" stroke-miterlimit="10" points="278.166,559.143 278.166,562.143 309.166,562.143 309.166,559.143
                276.667,559.143     " >
                <title>יציאת חירום</title>
            </polyline>
            <polygon class="redbooks" id="Staff_Publications" fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" points="419.667,405.917 415.5,405.848
                415.5,376.5 419.667,376.362     " >
                <title>פרסומי סגל</title>
            </polygon>
            <rect class="desk" id="comp_x5F_station_x5F_2" x="277" y="277.25" fill="none" stroke="#000000" stroke-miterlimit="10" width="8.685" height="9.917" >
                <title>עמדת מחשב</title>
            </rect>
            <rect class="desk" id="comp_x5F_station_x5F_1" x="277" y="351.708" fill="none" stroke="#000000" stroke-miterlimit="10" width="8.685" height="9.917">
                <title>עמדת מחשב</title>
            </rect>
            <rect class="desk" id="comp_x5F_station_x5F_3" x="498" y="215.042" fill="none" stroke="#000000" stroke-miterlimit="10" width="8.685" height="9.917">
                <title>עמדת מחשב</title>
            </rect>
            <rect class="desk" id="comp_x5F_station_x5F_4" x="498" y="199.583" fill="none" stroke="#000000" stroke-miterlimit="10" width="8.685" height="9.917">
                <title>עמדת מחשב</title>
            </rect>
            <polygon class="desk" id="comp_x5F_desk_x5F_win" fill="none" stroke="#000000" stroke-miterlimit="10" points="395.5,423.499 395.5,413.5
            361.5,412.5 361.5,423.5     " >
                <title>עמדת מחשב</title>
            </polygon>
            <text transform="matrix(0.0047 0.8645 -1 0.0054 90.5835 351.708)" font-family="'MyriadPro-Regular'" font-size="33.8333">אולם קריאה</text>
            <text transform="matrix(-0.0012 0.8645 -1 -0.0014 519.0498 493.9395)" font-family="'MyriadPro-Regular'" font-size="33.8333">אולם השאלה</text>
        </g>
    </svg>
</body>
</html>

0 个答案:

没有答案