您的位置:首页 > Web前端 > CSS

mozilla 中css的三种使用方法

2008-11-19 14:46 489 查看
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")//此语句无效;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: