百度空间CSS代码总教程

来源:互联网 发布:win7 for mac 下载 编辑:程序博客网 时间:2024/05/30 23:39

1、         display:nonecss全能隐藏代码

背景{}中添加background: url(图片地址)repeat
注:
repeat                        背景图像在纵向和横向上平铺
no-repeat                   背景图像不平铺
repeat-x                     背景图像在横向上平铺
repeat-y                     背景图像在纵向平铺

background-color:#颜色代码

超链接自定义设置超链接的属性就是在相关栏目名称后面+上a{}的属性

color:#颜色代码或颜色英文名称         定义超链接字体的颜色
font-family:字体名称               定义超链接字体
font-size:大小px                 定义超链接字体大小
text-decoration : 参数             定义超链接的文本装饰,参数:none || underline || blink || overline || line-through
              none :  无装饰
              blink :  闪烁
              underline :  下划线
              line-through :  贯穿线
              overline :  上划线  

其实超链接属性设置
a:hover{}             当鼠标移动到超链接上时显示的属性
a:link{}             超链接未被访问前显示的属性
a:visited{}           已经被访问过的超链接的属性
a:active{}           超链接被点击的时候显示的属性(在鼠标点击与释放之间发生的事件)

.modbl{}
.modbc{}
.modbr{}
这三个就是分别设置模版左下角,底边中央,右下角的代码:
.modbl{}中的border-left:是设置左下角左边框的属性的,border-bottom是设置左下角底边的边框属性的
.modbc{}中的border-bottom:是设置边框当中一段底边属性的
.modbr{}中的border-right:是设置右下角右边框的属性的,border-bottom是设置右下角底边的边框属性的

解决回车换两行的问题
Shift+回车

个性标题
#header div.tit{top:5px;left:20px;line-height:60px;font-size:60px;font-family:隶书}
#header div.tit a.titlink{color:#813533;text-decoration:none}
#header div.tit a.titlink:visited{color:#813533;text-decoration:none}
#header div.tit a.titlink:hover{color:#FFFFFF;text-decoration:none}
#header div.desc{top:27px;left:320px;color:#813533;font-size:16px}
说明:
#header div.tit{}                     这是标题的设置
#header div.tit a.titlink{}               这是标题超链接的设置
#header div.tit a.titlink:visited{}         这是标题超链接已经被访问过的设置
#header div.tit a.titlink:hover{}           这是当鼠标移动到标题超链接上时显示的属性
#header div.desc{}                     这是空间标题后面的简介的内容设置
属性和详细参数
top:5px                 距离模版顶部的间隔距离为5px
left:20px                 距离模版左边的间隔距离为20px
line-height:60px           设置总高度为60px
font-size:60px             设置字体大小为60px,这个不能设置的比的line-height大,否则标题字体的一部分会被遮掉
font-family:隶书           设置字体的型号
color:#813533             设置字体的颜色代码为#813533,这里也可以写颜色的英文名,比如black,white,red,green等
text-decoration:none         字体的划线修饰属性,none为无下划线,关于text-decoration的具体参数可以查看我前面写的关于定义超链接的文章

更多文章居右
#m_blog div.more{margin:14px 0 16px 0;text-align:right}

1.在友情链接添加“发送消息”的链接:
在友情链接里的链接地址内填上:
http://msg.baidu.com/ms?ct=21&cm=1&tn=bmSendMessage&un=你的百度用户名
这样点击该链接就可以给你发送消息,而这个链接另一个功能就是可以给自己发送消息。
2.在友情链接添加“加为好友”的链接:javascript:document.addfriend.submit()

去掉横向滚动条的方法是在body{ }里加上overflow-x : hidden;

—————————CSS系列—————————————

2、鼠标设置
在body{} 中添加;CURSOR: url('http://webme.bokee.com/inc/mouse028.cur')}  
a:hover{CURSOR: url('http://webme.bokee.com/inc/mouse031.ani')
第一行是鼠标指针初始形态,第二行是鼠标指针碰到链接的形态
CSS鼠标样式大全

/*不停变换空间背景图片*/
http://magic.qtutu.com/

/*发表评论中的背景*/
#spBlogCmtor{background:url(图片地址)}         /* 姓名*/
#spBlogCmtURL{background:url(图片地址) /* 网址或邮箱*/
background-attachment: fixed;
background-position: center center;
background-repeat: no-repeat;
}
#spBlogCmtText{background:url(图片地址)         /* 这是 内容中 的*/
background-attachment: fixed;
background-position: center center;
background-repeat: no-repeat;
}

/*改变你的按钮和输入栏的颜色及字体*/
input,select,textarea{color:green;font-size:14px;font-family:Tahoma,黑体;border:1px solid green;background-color:black}  
textarea{overflow:hidden}  

参数
color:green             表示字体颜色。  
font-size:14px               表示字体大小。  
font-family:Georgia,黑体           表示英文字体和中文字体  
border:1px                 表示边框的粗细。  
solid green                 表示边框的颜色。  
background-color:black           表示背景色。

/*最顶部加字方法!*/
#tabline{margin-top:-490px;right:0px;line-height:8px; background:url(图片地址) no-repeat bottom; padding-bottom: 40px; margin-bottom: 10px}
图片上面打上你要的字~

/*添加LOGO*/
#main {background:url(顶部LOGO) no-repeat 10px 0px;} /*10px 0px;距顶部 距左*/
#layout {width:980px;margin-left:0px;background:url(底部LOGO) no-repeat bottom 0px;padding-bottom:80px} /*margin-left:0px底部图片距离最左边长度;bottom 0px边框大小;padding-bottom:80px主体模块最下端距离底部图片最顶端距离*/

/*添加小背景图片*/
.stage{background:url(小背景图片) repeat-y 0px 0px} /*0px 0px距左        距顶(建议为0)*/

/*空间整体宽度*/
#main{width:740px!important;text-align:center}或#main{width:80%!important}

/*版块长度及间距*/
#layout td.c2t1{padding-left:55px;width:570px} /*最左版块*/
#layout td.c2t2{width:60px} /*左右两版块间距*/
#layout td.c2t3{width:260px;padding-right:30px} /*第2竖列版块信息*/

/*定义阅读文章时 文章块宽度 距左长度*/
.stagepad {width:570px;margin-left:44px;}
.stagepad a:link{text-decoration:none;font-weight:bold}
.stagepad a:visited{text-decoration:none;font-weight:bold}

/*文章虚线边框*/
#m_blog div.cnt{color:#333333;line-height:20px;font-size:14px;border:1px dashed #090688;background:#Ffffff;PADDING: 10px;}
/
#m_blog div.cnt{color:#808080;line-height:20px;font-size:16px;border-top:2px dashed #1DC01D;border-bottom:2px dashed #1DC01D;border-left:2px dashed #1DC01D;border-right:2px dashed #1DC01D;PADDING-RIGHT: 10px; PADDING-LEFT: 10px;PADDING-TOP: 10px;PADDING-bottom: 10px;}

dotted: 点线
dashed :  虚线  
double :  双线边框  
groove :  3D凹槽  
ridge :  菱形边框  
inset :  3D凹边  
outset :  3D凸边

/*前景图片透明设置*/
filter:alpha(opacity=90,finishopacity=100,style=0,)

/*留言板图片*/
#spBlogCmtText {border: 1px solid #A6B5C4;background:url(
http://***.jpg) no-repeat top center;background-attachment: fixed;}

/*播放器*/
#phx{FILTER: Alpha(Opacity=100, FinishOpacity=60, Style=2, StartX=20, StartY=40, FinishX=0, FinishY=0)Invert(); WIDTH: 224px;HEIGHT:200px}
—————————CSS系列—————————————
3、Invert();        滤镜效果 可以更换
/*不显示播放器,不影响音乐的播放*/
添加#mod_bgmusic{display:none}  

/*日志背景*/
#m_blog.modbox{background:url(图片)}
或#m_blog div.cnt{background:url(图片) repeat; /*图片*/color:#666666;line-height:20px;font-size:14px}

/*滚动条*/(源自吸水蚊子)
#m_blog{scrollbar-face-color: #E100E1;  
scrollbar-shadow-color: maroon;  
scrollbar-highlight-color: white;  
scrollbar-3dlight-color: #E100E1;  
scrollbar-darkshadow-color:#E100E1;  
scrollbar-arrow-color:#E100E1;  
scrollbar-base-color: #E100E1;  
scrollbar-track-color: #E100E1;  
overflow-y:auto;height:1330px;  
filter: chroma(color=#E100E1);}    

/*去掉横向滚动条*/
在body{ }里加上overflow-x : hidden;  

/*禁止选择 鼠标右键特效*/
#main{  
background:url('javascript:  
document.oncontextmenu=new Function("event.returnValue=false;");
document.onselectstart=new Function("event.returnValue=false;");
')}
(已经失效,只预览时显示效果)
document.oncontextmenu=new Function("event.returnValue=false;");禁止鼠标右键
document.onselectstart=new Function("event.returnValue=false;");
禁止选择/*鼠标触碰 按钮下陷*/
a:hover{}中加入 position:relative; left:2px; top:1px; clip:rect( );  

/*弹出窗口*/
#comm_info 和#comm_info a 替换#comm_info a{color:#D77B18 border: 1px solid #000000; padding: 10px; background-image: url('javascript:alert("你要说的话");')}

#comm_info{}或#m_links div.item{}
添加
background:url(javascript:alert(你要说的内容))

/*鼠标样式*/
平常状态 body{}中加入CURSOR: url('http://***.ani');
链接状态 a:hover{}中加入CURSOR: url('http://***.ani');

/*文章在新窗口中打开*/
a:active { text: (target="_blank");}

/*屏蔽Rss链接,baidu图片*/
#comm_info a {display:none;}

/*大背景*/
body{}中加入background:url(
http://***.gif) repeat-x #FFFFFF

/*标题背景*/
#header div.lc{}        -左
#header div.rc{}        -右
插入 background:url(http://***)

/*百度空间 进入后弹出对话框*/
去掉#comm_info div.line 把#comm_info a换成
#comm_info a{color:#D77B18 border: 1px solid #000000; padding: 10px; background-image: url('javascript:alert("你要说的话");')}

/*文章日期旁加小图案*/
#m_blog div.date
{text-indent:1.5cm;background:url(这里要填上你自己选的小图片的连接地址) 30% 0% no-repeat; /*背景图片*/margin:5px 0 8px 0;color:#999999;
line-height:50px; /*调整行高*/}

/*常用插入时间图片位置的代码*/
图片显示位置——个人档案照片下面:  
#m_pro div.act{margin-top:5px; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat bottom; padding-bottom: 22px; margin-bottom: 6px; }  

图片显示位置——文章列表 标题下面:  
#m_blog div.tit{font-size:14px;font-weight:bold; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat bottom; padding-bottom: 22px; margin-bottom: 6px; }  

图片显示位置——文章列表 标题左面:  
#m_blog div.tit{font-size:14px;font-weight:bold; line-height:24px; text-indent:120px; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat; }  

图片显示位置——TAB导航栏:
#tabline{top:89px; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat bottom; padding-bottom: 32px; margin-bottom: 6px; }  

图片显示位置——相册下面:  
#m_album div.image{text-align:center; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat bottom; padding-bottom: 45px; margin-bottom: 1px; }  

图片显示位置——每个友情链接下面:  
#m_links div.line{margin-top:5px;line-height:8px;border-top:1px solid #F4C1B5; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat bottom; padding-bottom: 16px; margin-bottom: 10px; }  

图片显示位置——每个最新评论下面:  
#m_comment div.item{color:#000000;font-size:12px; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat bottom; padding-bottom: 22px; margin-bottom: 6px; }  

图片显示位置——每个文章分类下面:  
#m_artclg div.line{margin-top:5px;line-height:8px;border-top:1px solid #F4C1B5; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat bottom; padding-bottom: 16px; margin-bottom: 10px; }  

图片显示位置——其他区域:  
#comm_info div.line{margin-top:5px;line-height:8px;border-top:1px solid #BBC1C6; background:url(
http://escati.linkopp.net/cgi-bin/date.cgi?trgb=red&srgb=red&prgb=red&timezone=GMT-0500) no-repeat bottom; padding-bottom: 22px; margin-bottom: 6px; }  

/*分割线*/
{margin-top:17px;line-height:12px;background:url(
http://***.gif) repeat-x}    

/*<其它>模块中只显示访问人数*/
#comm_info a {display:none}

/*发光效果*/  
{}中加入filter:glow (color= #299BE8,strength=2);

/*阴影效果字体阴影*/
{}中加入filter:DropShadow(Color=#000000:,OffX=2, OffY=3,Positive=1);或filter:shadow(Color=#000000:,OffX=2, OffY=3,Positive=1);
参数作用:
Color=阴影的颜色代码
OffX=设置阴影与对象(文字或图片)的横向距离偏移
OffY=设置阴影与对象的竖向距离偏移
Positive=设置建立阴影的对象,true是为非透明像素建立阴影,false是为透明的像素建立阴影,一般不建议使用false
另外,如果添加阴影的地方已经有了filter的参数,例如设置透明度的filter:alpha(),只需把DropShadow(Color=#000000, OffX=3, OffY=3, Positive=true)添加到alpha()的后面即可,这里不需要间隔,当中留空格可以,间隔将无效
例如在原来的filter:alpha(opacity=50);后面加上阴影效果代码:
filter:alpha(opacity=50)DropShadow(Color=#000000, OffX=3, OffY=3, Positive=true);

/*投影的代码*/
filter:Shadow(Color=gray/*颜色*/,Direction=135/*方向*/)

/*文章标题背景*/
#m_blog div.tit{text-indent:1.5cm/*缩近*/;line-height:75px;/*增大行高,使背景图片完全显示*/font-size:16px;font-weight:bold;background:url(
http://***.gif) no-repeat;/*标题背景图片,不重复*/}
line-height:多少px;          设置标题的高度,其实这里的设置为图片的高度就可以了
text-indent:多少px;          设置标题的文本前面空多少宽度,这里可以填图片的宽度,为了美观起见,可以再多+5、6px,因为图片和标题贴着不好看,这个主要还是看个人感觉和喜好设置了

/*空间透明*/
.modbox,.modbl,.modbc,.modbr{filter:alpha(opacity=80);-moz-opacity:0.8;width:auto !important;width:100%}

—————————CSS系列—————————————
4、/*添加自己的LOGO图片*/
#comm_info div.line{margin-top:4px;line-height:8px;border-top:2px solid #ff3333;        background:url(
http://***.gif) no-repeat bottom; padding-bottom: 32px; margin-bottom: 32px}  

/*添加LOGO*/
#m_pro div.image{}加入background:url(
http://***.jpg) no-repeat bottom;padding-bottom:100px
           bottom让图片沉底
           padding-bottom增加头像模块底下的宽度
           padding-bottom数值一般设置为LOGO的高度值,LOGO的上边与头像的下边距离0,加大padding-bottom的数值,LOGO的上边与头像的下边距离亦加大

/*给评论框加背景图片*/
#spBlogCmtText {border: 8px solid #000000 ;  
background:url(图片地址) no-repeat top center;  
background-attachment: fixed;}

/*如何设定+固定百度空间的背景*/
在body{}中加入
background-image:url(图片地址) ;            定义背景图片
background-repeat: no-repeat;              定义背景图片不重复
background-position: center;              定义背景居中
background-attachment: fixed;              定义背景固定,不滚动参数fixed

/*去除模块背景即完全背景透明*/
删除模块background-color:……的属性;加background:transparent即可
在header{}中加入
background:transparent                这个参数的作用是使完全背景透明,并删除原来的属性background:url(……)
#header div.rc{}以及.stage{}与header{}同样设置

/*右下角弹出窗口*/
#main{  
background:url('javascript:  
var sunPop = window.createPopup();  
var popTop=50;  
function popmsg(msgstr){  
var winstr="<table style=/"border:solid #A96D13 1px/" width=/"200/" height=/"150/" border=/"0/" cellpadding=/"0/" cellspacing=/"0/" bgcolor=/"#88CFFF/" >";  
winstr+="<tr><td height=/"30/"> </td></tr><tr><td align=/"center/"><table width=/"90%/" height=/"110/" border=/"0/" cellpadding=/"0/" cellspacing=/"0/">";  
winstr+="<tr><td valign=/"top/" style=/"font-size:12px; color:#209C20; face:黑体/">"+msgstr+"</td></tr></table></td></tr></table>";  
sunPop.document.body.innerHTML=winstr;  
popshow();  
           }  
function popshow(){  
window.status=popTop;  
if(popTop>1720){  
clearTimeout(mytime);  
sunPop.hide();  
return;  
}else if(popTop>1520&&popTop<1720){  
sunPop.show(screen.width-250,screen.height,200,1720-popTop);  
}else if(popTop>1500&&popTop<1520){  
sunPop.show(screen.width-250,screen.height+(popTop-1720),200,150);  
}else if(popTop<180){  
sunPop.show(screen.width-250,screen.height,200,popTop);  
}else if(popTop<220){  
sunPop.show(screen.width-250,screen.height-popTop,200,150);  
}  
popTop+=10;  
var mytime=setTimeout("popshow();",50);  
}  
popmsg("2006年12月1日<br>你好,亲爱得朋友。<br>你要说的话。<br>你要说的话~");
')  
}  

/*“发表评论”区域*/
#in_send div.tit{margin:10px 0 10px 0;color:#FFFFFF;font-size:14px;font-weight:bold}    

设置“发表评论”区域上方的“发表评论”四个大字,其中color:#FFFFFF设置字的颜色,font-size设置字的大小,font-weight:hold设置让这字体加粗,不加粗删掉。  

#in_send td{color:#FFFFFF}  

设置“姓名”、“网址或邮箱”和“内容”字的颜色。  

#spBlogCmtText {border: 1px solid #FFCCFF;background:#FFFFFF       no-repeat top center; background-attachment: fixed}  

设置评论框底色。background:#FFFFFF设置颜色,添加图片则改为background:url(图片),
图片最佳尺寸是503*153       1px 表示评论边框的宽度       #FFCCFF 表示评论边框的颜色。  

/*隐藏“查看该用户在百度的”分类*/
加入#m_pro .basic a.nlk{display:none}代码即可

/*隐藏“百度空间测试版”*/
#m_comm_info img{display:none}

 
原创粉丝点击