CSS背景图片的正则表达式怎么写

html-css09

CSS背景图片的正则表达式怎么写,第1张

比如url(images/nan_bg_o.jpg)这是背景图的css写法,它的正则表达式如下

VBScript codes=".x{background:url(images/nan_bg_o.jpg)}.xx{}.xxx{background: URL(images/nan_bg_oxx.jpg) }"

set rx=new RegExp

rx.IgnoreCase=true

rx.Global=true

rx.Pattern="url\s*\(([^\)]+)\)"

set mc=rx.Execute(s)

for each m in mc

response.Write "<pre>"&m.submatches(0)&"</pre>"

next

set rx=nothing

CSS中没有正则表达式。你那样的是CSS 2.0+

div[class^=ad(1|2|3|4)]

上面那样的写法是不合法的

只有写成div[class^="ad1"],div[class^="ad2"],div[class^="ad3"],div[class^="ad4"]

<style>

div span[style*="font-size"]{

color:red

}

</style>

<div><span style="font-size:30px">aaaa</span></div>

E[att^=”val”] 属性att的值以"val"开头的元素

E[att$=”val”] 属性att的值以"val"结尾的元素

E[att*=”val”] 属性att的值包含"val"字符串的元素

我试着可以啊,颜色变成红的了