mozilla 中css的三种使用方法

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")//此语句无效;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值