html/css.属性优先级测试

1、ZC:测试下来,属性优先级的关系为(优先级从高到低):style属性 > class属性 > 直接在节点上设置的属性

2、测试代码:

<?xml version="1.0" encoding="UTF-8"?>
<svg width="1000" height="800" viewBox="-500 -200 1000 800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cge="http://iec.ch/TC57/2005/SVG-schema#" xmlns:hzsvg="http://holleygrid.cn/svg">

    <style type="text/css">
    <![CDATA[
    <!--

    .kv01
    {
        fill :red;
    }

    -->
    ]]>
    </style>

    <script type="text/javascript" >
    <![CDATA[
    <!--
    -->
    ]]>
    </script>



<rect x="10" y="-100" width="200" height="50" stroke="red" fill="blue" class="kv01" style="fill:yellow"/>

<rect x="10" y="-30"  width="200" height="50" stroke="red" fill="blue" class="kv01"/>

<rect x="10" y="40"   width="200" height="50" stroke="red" fill="blue" />

</svg>
<?DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"?>

 

3、chrome [ 版本 68.0.3440.106(正式版本) (32 位) ] 显示(Win7x64上):

 

4、

5

 

posted @ 2018-08-23 15:06  Html5Skill  阅读(802)  评论(0编辑  收藏  举报