Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 替换css中的大小参数_C#_Css_Regex_Replace - Fatal编程技术网

C# 替换css中的大小参数

C# 替换css中的大小参数,c#,css,regex,replace,C#,Css,Regex,Replace,我想替换html文档css属性中的所有字体大小参数。 我正在使用.net和c。 我想可以用一些正则表达式来实现 我忘了其他一些设置字体大小的方法了吗 例如: <html> <head> <style type="text/css"> .t { font-size: large; } </style> </hea

我想替换html文档css属性中的所有字体大小参数。 我正在使用.net和c。 我想可以用一些正则表达式来实现

我忘了其他一些设置字体大小的方法了吗

例如:

<html>
    <head>
        <style type="text/css">
             .t {
                 font-size: large;
             }
        </style>
    </head>
    <body>
        <span style="font-size: medium" />
    </body>
</html>
进入:

<html>
    <head>
        <style type="text/css">
             .t {
                 font-size: large_replaced;
             }
        </style>
    </head>
    <body>
        <span style="font-size: medium_replaced" />
    </body>
</html>

如果您在页面中的所有字体尺寸都使用相对单位,如em、ex等。通过调整 只有html元素的大小才能管理所有字体

大字体

html{
 font-size:18px;
}
小字体

html{
 font-size:18px;
}

您可以管理该表单javascript,更好的方法是使用cookies。

我最后使用以下正则表达式来查找替换位置:

/style=\"[.]*font-size:(?<size>[^;]*);[^\"]*[\"]/
/<style[^<]*font-size:(?<size>[^;]*);[^<]*[<]/

但我想替换它们:我正在将其设置为正确答案,因为最终这是我所寻求的解决方案。我能解决我的上述问题,但结果不好。所以任何尝试过这个的人都不要