1.内嵌样式表
<vbox style="border-style: solid; border-width: 1px; border-color: blue;">
2.内部样式表
内部样式表引入位置比较特殊,<?xml-stylesheet href="data:text/css,
/* your styles here*/" type="text/css"?>,要放在xml-stylesheet的href引用中,如下示例
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="data:text/css,
.colorStyle
{
color:red;
}
#myLabel
{
color:blue;
}
" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label class="colorStyle" value="内部样式"/>
<label id="myLabel" value="内部样式"/>
</window>
3.外部样式表
先引入文件
<?xml-stylesheet href="mycss.css" type="text/css"?>-
然后就可以使用mycss.css中定义的样式了
//在.css中有这样一个样式类
.vboxStyle
{
border-style: solid;
border-width: 3px;
border-color: red;
}
这样,在.xul标签中就可以使用外部样式了
<vbox class="vboxStyle"/>
//over
可以在js中动态改变标签的样式类,
document.getElementById('myhello').setAttribute("class","helloStyle2");//此语句有效
但通过绑定得到的属性不会被removeAttribute方法移出
var obj=document.getElementById('myhello').removeAttribute("src")//此语句无效;