30分钟玩转Blog定制

类别:Java 点击:0 评论:0 推荐:

本来还真打算要放弃CSDN的Blog了,但是看着自己辛辛苦苦积累下来的内容,真的有点舍不得.而且,换了Blog就好像换了手机号码,还要再通知朋友们.想来想去,总是觉得有些成本过高.不过在找其他的Blog服务提供商的同时,看到了不少漂亮的Blog,于是心中为之一动:不如自己也先把Blog打扮起来吧.于是就有了这个花费了5个小时全新打造的Blog.——当然,这是因为我花费了很多时间在找一些合适的东西上面,您现在看了我这篇东西,就不用这么费劲了,如果熟悉代码,30分钟完全可以搞掂.

其实CSDN的Blog可以定制的地方就只有"Blog管理—>选项—>配置"下的"定制CSS选择器"和"静态新闻/声明".其中CSS部分负责界面的风格和样式,而"静态新闻/声明"部分则可以用来改变界面中包含的元素和内容.下面贴出的是我现在这个Blog中关于上面两项的修改内容,仅供参考.


 

“定制CSS选择器"部分

BODY {

  MARGIN: 0px; BACKGROUND-COLOR: #fafafa

}

A {

  COLOR: #00f; TEXT-DECORATION: none

}

A:hover {

  COLOR: black; TEXT-DECORATION: none

}

H2 {

  MARGIN: 0px 0px 10px

}

#top {

  FILTER: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#0A6CCE', endColorStr='#FFFFFF', gradientType='1'); COLOR: #fff; BORDER-BOTTOM: #443 0px solid; HEIGHT: 100%

}

#top H1 {

  PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; PADDING-TOP: 2px

}

#top H1 A {

  COLOR: #fff;

}

#menu {

  BORDER-TOP: #999 1px solid; FONT-SIZE: 100%; BACKGROUND: #f1f1f1; PADDING-BOTTOM: 2px; MARGIN: 0px; PADDING-TOP: 2px; BORDER-BOTTOM: #999 1px solid

}

#menu UL {

  height: 100%; FONT-size: 100%; COLOR: black; TEXT-DECORATION: none; MARGIN: 0px 0px 0px 20px; PADDING: 0px; LIST-STYLE-TYPE: none;

}

#menu LI {

  height: 100%; FONT-SIZE: 100%; BORDER-RIGHT: #a9a9a9 1px solid; PADDING-RIGHT: 2px; DISPLAY: inline; PADDING-LEFT: 2px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px;

}

#menu li a {

  height:100%; FONT: 80% Verdana; COLOR: black; TEXT-DECORATION: none;

}

#menu LI A {

  border: 1px #f1f1f1 solid; padding-left: 6px; padding-right: 6px; padding-top:1px; padding-bottom:1px; margin: 0px; background-color: #f1f1f1; COLOR: black; TEXT-DECORATION: none;

}

#menu LI A:hover {

  border: 1px #999 solid; padding-left: 6px; padding-right: 6px; padding-top:1px; padding-bottom:1px; margin: 0px; background-color: #ccc; COLOR: black; TEXT-DECORATION: none;

}

#MyLinks1_XMLLink {

  VISIBILITY: hidden; width: 0px; height: 0px; padding: 0px; margin: 0px;

}

#MyLinks1_XMLLink IMG {

  VISIBILITY: hidden; width: 0px; height: 0px; padding: 0px; margin: 0px;

}

#leftmenu H3 {

  BORDER: #999 0px ; BORDER-BOTTOM: none; HEIGHT: 100%; MARGIN: 0px; PADDING: 5px; FILTER: progid:DXImageTransform.Microsoft.Gradient(endColorstr='#ffffff', startColorstr='#4992DB', gradientType='0');

}

#leftmenu UL {

  BORDER-RIGHT: #999 0px ; PADDING-RIGHT: 5px; BORDER-TOP: #999 0px ; MARGIN-TOP: 0px; PADDING-LEFT: 4px; MARGIN-BOTTOM: 10px; PADDING-BOTTOM: 4px; MARGIN-LEFT: 0px; BORDER-LEFT: #999 0px ; PADDING-TOP: 4px; BORDER-BOTTOM: #999 0px

}

#leftmenu LI A {

  COLOR: black; TEXT-DECORATION: none;

}

#leftmenu LI A:hover {

  COLOR: black; TEXT-DECORATION: underline;

}

#main {

  PADDING: 10px; MARGIN-LEFT: 170px;  BORDER: none; BORDER-LEFT: #999 1px solid; BORDER-BOTTOM: #999 4px solid; BACKGROUND-COLOR: #ffffff

}

#main P.date {

  BORDER: #999 1px solid; BORDER-BOTTOM: none; PADDING: 5px; MARGIN: 0px; HEIGHT: 100%; FILTER: progid:DXImageTransform.Microsoft.Gradient(endColorstr='#4992DB', startColorstr='#FFFFFF', gradientType='1');

}

#main DIV.post {

  BORDER: #999 1px solid; PADDING: 5px; MARGIN: 0px 0px 10px;

}

#main A, A:hover, A:visited {

  COLOR: #700;

}

#main P.postfoot {

  PADDING: 0px; PADDING-TOP: 5px; PADDING-BOTTOM: 2px; MARGIN: 10px 0px 0px; BORDER-TOP: #999 1px dotted;

}

#comments {

  MARGIN-BOTTOM: 10px; COLOR: #700

}

#comments H3 {

  COLOR: #700

}

#comments H4 {

 

}

#comments P {

  BORDER-BOTTOM: #dddddd 1px solid

}

#comments P A {

  FONT-SIZE: 9px; COLOR: darkblue

}

#comments H4 SPAN {

  COLOR: #999

}

#footer {

  FONT-SIZE: 0px; VISIBILITY: hidden; MARGIN: 0px; PADDING-TOP: 0px; HEIGHT: 0px; TEXT-ALIGN: center

}

#footer IMG {

  VISIBILITY: hidden; WIDTH: 0px; HEIGHT: 0px

}

#div_list P {

  FONT-SIZE: 12px

}

#div_list IMG {

  BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid

}

#imageFrame DIV.div_image {

  MARGIN-TOP: 20px; TEXT-ALIGN: center

}

#imageFrame DIV.div_link {

  TEXT-ALIGN: center

}

#commentform TABLE {

  BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px

}

#commentform TD {

  BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px

}

#commentform TR {

  BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px

}

#main DIV.cus_code {

  COLOR: #465584; FONT-SIZE: 12px; FONT-FAMILY: Courier New;BORDER: #000000 1px solid;BORDER-LEFT: #666666 6px solid; PADDING-LEFT: 0px 0px 0px 0px;MARGIN: 10px 20px;BEHAVIOR: url("/images/upload/myhan/formatPhpCode.htc"); BACKGROUND-COLOR: #ffffff;

}


 

"静态新闻/声明"部分

1.添加自己的照片

<center><img src=http://www.testage.net/bbs/uploadFace/200461710423388998.jpg width=128 height=128 border="0"><br>

—————————————<br>”<br>表示换行”

2.添加个人简介

<b><font color="blue">陈雷</font></b><br>

<b><font color="blue">软件测试工程师</font></b><br>

<b><font color="blue">《程序员》特约撰稿人</font></b><br>

<b><font color="blue">来自山东 服务广州</font></b><br>

3.添加email联系方式

<a href="mailto:[email protected]" >[email protected]</A><br>

—————————————

4.插入计数器

<script language=JavaScript src="http://laoan.com/counters/count.php?jackei"></script><br>

—————————————<br></center>

5.插入公告内容

因为首页中最多只能显示25条记录,所以很多文章的链接在首页中看不到,请点击下面“文章”分类中的相应类别或点击“存档”下面的相应时间来进行访问。除特别说明外,本Blog中的内容均为本人原创,本人依法保留Blog内原创文章的所有权利,如需转载,请注明作者及出处。未经许可,不得将本Blog内文章用于任何盈利性用途。<br><br>

6.插入flash时钟

<DIV align=center>

<OBJECT style="WIDTH: 84px; HEIGHT: 84px" codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 height=84 width=84 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="_cx" VALUE="2223"><PARAM NAME="_cy" VALUE="2223"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="http://blogcup.com/cup/time.swf"><PARAM NAME="Src" VALUE="http://blogcup.com/cup/time.swf"><PARAM NAME="WMode" VALUE="Transparent"><PARAM NAME="Play" VALUE="0"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE="always"><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1">

<embed src="http://blogcup.com/cup/time.swf" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="32" height="32"></embed>

</OBJECT></DIV>

<br>

7.插入日历

<!-- Blog日历表开始 -->

<script language="javascript">

var diarydays="<2004-08-05><2004-08-09><2004-08-12><2004-08-17><2004-08-19><2004-07-14><2004-07-13><2004-07-08><2004-07-05><2004-07-04><2004-07-03><2004-06-27><2004-06-26><2004-06-25>";

</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<style>

.calendarBigBorder { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; text-decoration: none; width: 170; background-color: #FFFFFF; font-size: 9pt;border:1px dotted #999; }

.calendarTd { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #000000; background-color: #eeeeee; height: 18px; width: 11%; text-align: center;}

.calendarMInput { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; text-decoration: none; background-color: #FFFFFF; height: 15px; border: 1px solid #666666; width: 19px; color: #0099FF;}

.calendarYInput { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #0099FF; text-decoration: none; background-color: #FFFFFF; height: 15px; width: 34px; border: 1px solid #666666;}

.calendarMonthTitle { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: normal; height: 24px; text-align: center; color: #333333; text-decoration: none; background-color: #eeeeee; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-bottom-style: none; border-top-color: #999999; border-right-color: #999999; border-bottom-color: #999999; border-left-color: #999999;}

.calendarNow { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: bold; color: #000000; background-color: #C0C9D3; height: 18px; text-align: center;}

.calendarDaySat { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #333333; text-decoration: none; background-color: #eeeeee; text-align: center; height: 18px; width: 12%;}

.calendarDaySun { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #333333; text-decoration: none; background-color: #eeeeee; text-align: center; height: 18px; width: 12%;}

.calendarLink { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: normal; color: #333333; text-decoration: none; background-color: #E7E7F6; text-align: center; height: 18px;}

.categoryTxt { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; line-height: 23px; color: #333333; text-decoration: none;}

.categoryTable { border-right-width: 1px; border-bottom-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-right-color: #000000; border-bottom-color: #000000; border-top-width: 1px; border-top-style: solid; border-top-color: #71b99c;}

</style>

<SCRIPT LANGUAGE="JavaScript">

var months = new Array("一", "二", "三","四", "五", "六", "七", "八", "九","十", "十一", "十二");

var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31);

var days = new Array("日","一", "二", "三","四", "五", "六");

var classTemp;

var calendarHover="calendarHover";

var today=new getToday();

var year=today.year;

var month=today.month;

var newCal;

//得到某月天数

function getDays(month, year)

{ if (1 == month)

     return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28;

  else

     return daysInMonth[month];

}

//得到当天时间信息

function getToday()

{  this.now = new Date();

   this.year = this.now.getFullYear();

   this.month = this.now.getMonth();

   this.day = this.now.getDate();

}

//生成日历

function Calendar()

{  newCal = new Date(year,month,1); //当前月的第一天

   today = new getToday();

   var day = -1;   //用来判断日历中是否为当天

   var startDay = newCal.getDay(); //当月开始时间

   var endDay=getDays(newCal.getMonth(), newCal.getFullYear());//当月结束时间

   var daily = 0;   //用来生成日历中的天数值

   if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))

      day = today.day;

   var caltable = document.all.caltable.tBodies.calendar;  //得到日历表格的集合

   var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear()); //得到当月天数

   //生成日历

   for (var intWeek = 0; intWeek < caltable.rows.length;intWeek++)

     for (var intDay = 0;intDay < caltable.rows[intWeek].cells.length;intDay++)

     {

      var cell = caltable.rows[intWeek].cells[intDay];   //得到单元袼

   //生成字符串用于判断当天是否有日志

      var montemp=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1);

      if ((intDay == startDay) && (0 == daily)){ daily = 1;}

      var daytemp=daily<10?("0"+daily):(daily);

      var d="<"+newCal.getFullYear()+"-"+montemp+"-"+daytemp+">";

   //选择样式

      if(day==daily)

      cell.className="calendarNow";

      else if(diarydays.indexOf(d)!=-1)

         cell.className="calendarLink";

      else if(intDay==6)

      cell.className = "calendarDaySat";

      else if (intDay==0)

      cell.className ="calendarDaySun";

      else

      cell.className="calendarTd";

   //生成值

      if ((daily > 0) && (daily <= intDaysInMonth))

      {  cell.innerText = daily;

         daily++;

      }

      else

        cell.innerText = "";

    }

  document.all.year.value=year;

  document.all.month.value=month+1;

}

 

function subMonth()

{

  if ((month-1)<0)

  {

     month=11;

  year=year-1;

  }

  else

  {

    month=month-1;

  }

  Calendar();

}

function addMonth()

{

  if((month+1)>11)

  {

    month=0;

    year=year+1;

  }

  else

  {

    month=month+1;

  }

  Calendar();

}

//得到响应事件

function getDiary()

{

  var mon=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1);

  var day=event.srcElement.innerText<10?("0"+event.srcElement.innerText):(event.srcElement.innerText);

  var d="<"+newCal.getFullYear()+"-"+mon+"-"+day+">";

  if ("TD" == event.srcElement.tagName)

  if (("" != event.srcElement.innerText)&&(diarydays.indexOf(d)!=-1))

  {

   diary.location="/foxmail/archive/"+newCal.getFullYear()+"/"+mon+"/"+day+".aspx";

   window.location.href = diary.location;

  }

}

 

function setDate()

{

  if (document.all.month.value<1||document.all.month.value>12)

  {

    alert("月的有效范围在1-12之间!");

 return;

  }

  year=Math.ceil(document.all.year.value);

  month=Math.ceil(document.all.month.value-1);

  Calendar();

}

</SCRIPT>

<table border="0" cellpadding="0" cellspacing="1" class="calendarBigBorder" id="caltable" width="200">

<thead>

     <tr align="center" valign="middle">

    <td colspan="7" class="calendarMonthTitle">

   <input name="year" type="text" class="calendarYInput" size="3" maxlength="4" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')"  onpaste="this.value=this.value.replace(/[^0-9]/g,'')">年

   <input name="month" type="text" class="calendarMInput" size="1" maxlength="2" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')"  onpaste="this.value=this.value.replace(/[^0-9]/g,'')">月 [<a onClick="addMonth()" href="javascript:;">下月</a>] [<a  onClick="subMonth()" href="javascript:;">上月</a>]</td>

  </tr>

 <tr align="center" valign="middle">

 <SCRIPT LANGUAGE="JavaScript">

 document.write("<TD class=calendarDaySun id=diary>" + days[0] + "</TD>");

 for (var intLoop = 1; intLoop < days.length-1;

 intLoop++)

 document.write("<TD class=calendarTd id=diary>" + days[intLoop] + "</TD>");

 document.write("<TD class=calendarDaySat id=diary>" + days[intLoop] + "</TD>");

 </SCRIPT>

 </TR>

</thead>

  <TBODY border=1 cellspacing="0" cellpadding="0" ID="calendar" ALIGN=CENTER ONCLICK="getDiary()" onmouseup=document.selection.empty() oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty() onselect=document.selection.empty()>

    <SCRIPT LANGUAGE="JavaScript">

  for (var intWeeks = 0; intWeeks < 6; intWeeks++) {

  document.write("<TR style='cursor:hand'>");

  for (var intDays = 0; intDays < days.length;intDays++)

  document.write("<TD class=calendarTd onMouseover='{classTemp=this.className;this.className=calendarHover}' onMouseOut='this.className=classTemp'></TD>");

  document.write("</TR>");

  }

 </SCRIPT>

  </tbody>

 </table>

<script  LANGUAGE="JavaScript">

Calendar();

</script>

<!-- Blog日历表结束 -->

<br>

8.插入天气预报查询

<IFRAME border=0 align=center marginWidth=0 marginHeight=0 src='http://appnews.qq.com/cgi-bin/news_qq_search?city=' frameBorder=0 width=157 scrolling=no height=240 allowTransparency></IFRAME>

<br>

 

 

您可以直接把这些代码copy到自己的Blog中来使用,也可以以此为启发,定制出自己的个性化Blog.

本文地址:http://com.8s8s.com/it/it13087.htm