js 修改CSS文件中的样式
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style id="">
.class1{
margin-left:135px;
margin-top:1px;
}
.b{
margin-left:135px;
margin-top:1px;
}
</style>
<script>
function hidden(){
if(typeof document.styleSheets != "undefined")
{
var printStyleSheet = document.styleSheets[0];
var printRules = null;
if (typeof printStyleSheet.rules != "undefined")
{
printRules = printStyleSheet.rules;
}else{
printRules = printStyleSheet.cssRules;
}
for(var i=0; i <printRules.length; i++)
{
//alert(printRules[i]["selectorText"]);
if(printRules[i]["selectorText"]==".class1")
{
printRules[i].style.display = "none";
}
}
}
}
</script>
</HEAD>
<BODY>
<div class="class1">123446</div>
<br />
<a href="#" onclick="hidden();">CLICK ME</a>
</BODY>
</HTML>
相关文档:
如果在用CSS设计布局时遇到BUG,请认真阅读以下内容,非常容易记忆的,不知道哪位高人把CSS BUG编成了顺口溜了!看看好不好记住呢?
一、IE边框若显若无,须注意,定是高度设置已忘记;
二、浮动产生有缘故,若要父层包含住,紧跟浮动要清除,容器自然显其中;
三、三像素文本慢移不必慌,高度设置帮你忙 ......
文字自动使用样式
.inputText{
border:1px solid #7898b8;
height:20px;
padding-left:2px;
line-height:20px;
background-image:url(images\\inputtext_bg.gif);
background-repeat:repeat-x;
color:#339900;
}
.inputText是 字体自动设置样式的名称
各种控件自动套用样式
比如table,td
table{border-colla ......
/*
*创建人:蔺宜忠
*用途:学习css,应用于新闻系统
*/
*
{
/*把默认值设置为0*/
margin: 0;
padding: 0;
border-width: 0;
}
body
{
font-size: 14px;
}
a:link,a:visited
{
/*鼠 ......
<div id="imgbox" style="height:110px;width:600px;overflow:hidden;">
<div id="imgbox1" style="float:left;width:1000%">
<img src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.gif" mce_src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.gif">
<img src="http://www ......
可以在博客的配置页面的自定义css栏中填入css样式代码来自定也blog的风格
csdn blog的页面架构基本是由div实现的,整个页面主要由三个div组成,它们的id分别是:
csdnblog_header, csdnblog_sidebar, csdnblog_content。
所以,定义它们的主体样式可以这样:
#csdnblog_header
{
//头部的风格
}
# ......