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")//此语句无效;
<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")//此语句无效;
相关文章推荐
- 在HTML中使用CSS美化网页的三种方法
- Div+css_页面使用css的三种方法
- css三种样式引入方法,html链接,html中<table>的使用方法
- 在HTML中使用CSS美化网页的三种方法
- CSS的三种使用方法。 行内样式: 内嵌式: 外部式:
- 在HTML中使用CSS美化网页的三种方法
- CSS三种使用方法
- HTML5 CSS介绍及三种使用方法
- 浅谈Category的三种使用方法
- 页面启动自动使用jquery实现自动加载方法的三种形式
- Win32 API中使用定时器的三种方法
- 23_css清除浮动的三种方法.html
- css中已知宽高的子元素水平垂直居中的三种方法
- struts2系列十之4中获取使用request,session,application的方法和页面显示的三种方法【后期ognl算第四种】
- Android中使用定时器的三种方法
- 通过Curl、socket、file_get_contents三种方法使用POST提交数据
- 使用jquey的css()方法改变样式,
- 使用CSS绘制星级评分效果的方法
- meego中css主题文件的使用方法
- 比较简单实用的使用正则三种版本的js去空格处理方法