重要資訊內容 重要資訊內容 重要資訊內容 重要資訊內容 重要資訊內容 重要資訊內容 重要資訊內容

2009年3月30日星期一

怎么在文章中添加代码呢

blogger博客非常好,大家都知道,可就是不能在文章中写代码,大家也知道,可怎么办呢?大家都不知道,我知道,呵呵。写的真绕口!!
办法如下:
1.加上css (在css中定义)

CODE {
display: block; /* fixes a strange ie margin bug */
font-family: Courier New;
font-size: 8pt;
overflow:auto;
background: #f0f0f0 url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;
border: 1px solid #ccc;
padding: 10px 10px 10px 21px;
max-height:200px;
height:200px; // for IE6
line-height: 1.2em;
}



2.将代码写在<code></code>之中,例如:

<code>.comment-body-author {<br /> margin:0;<br /> padding:0 0 0 20px;<br />
background-color:#C0C0C0;<br /> }</code>


效果

.comment-body-author {
margin:0;
padding:0 0 0 20px;
background-color:#C0C0C0;
}



还有一种办法看看



实现办法是

<br /><center><form><textarea rows="3" cols="50" readonly>代码部分</textarea></form></center><br />


另外提供个在线代码辅助連上Postable網頁在线写代码,打开网页后,把你的代码粘贴上点右下方按钮,得到的结果,就可以在文章中正常表示了。


呵呵,就这么简单,我知道了,所以 分享 给大家


1 评论:

发表评论

  © 广告业务联系站长:wj9931@gmail.com 或 QQ42032058.