隨筆 - 9  文章 - 21  trackbacks - 0
          <2008年2月>
          272829303112
          3456789
          10111213141516
          17181920212223
          2425262728291
          2345678

          常用鏈接

          留言簿(1)

          隨筆分類(9)

          隨筆檔案(9)

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          摘要

          我們?cè)趯?xiě)blog或?qū)懳臋n說(shuō)明的時(shí)候,有時(shí)候說(shuō)明在控制臺(tái)中怎樣使用,在windows xp/2000中就是cmd命令。 為了表達(dá)這種在控制臺(tái)中的操作,我寫(xiě)了個(gè) CSS來(lái)呈現(xiàn)效果。

          需求和設(shè)計(jì)要求

          1. 在網(wǎng)頁(yè)文檔中(blog或用戶手冊(cè)),呈現(xiàn)一個(gè)控制臺(tái)的樣式,有邊框和標(biāo)題欄,黑色背景。如下圖
          2. 這個(gè)控制臺(tái)可以真實(shí)的控制臺(tái)那樣可以,在適當(dāng)?shù)臅r(shí)候,有上下或左右滾動(dòng)條
          3. 控制臺(tái)里允許加入的元素有<p>塊。
          4. 為了區(qū)分控制臺(tái)里的輸入和輸出字符串,分別可以用<kbd>和<samp>括起來(lái),然后設(shè)置他們的CSS樣式
          5. 當(dāng)前目錄提示符,用<span>元素表達(dá)。
          6. <kbd>、<samp>和<span>元素只能包含在<p>元素中,不能直接在“控制臺(tái)”中。

          控制臺(tái)效果圖

          實(shí)現(xiàn)

          • 控制臺(tái)標(biāo)題用背景圖片實(shí)現(xiàn)
          • 因?yàn)橥瑫r(shí)有標(biāo)題和滾動(dòng)條,所以為了不讓滾動(dòng)條覆蓋部分標(biāo)題,控制臺(tái)至少要用兩個(gè)<div>來(lái)表達(dá),一個(gè)表示控制臺(tái)邊框,一個(gè)表示控制臺(tái)里內(nèi)容
          • 控制臺(tái)的寬度是固定的,高度有控制臺(tái)的內(nèi)容層表達(dá)

          CSS

          @charset "utf-8";

          /**
          * Copyright (c) 李四 fourlee@live.cn
          */

          /* 控制臺(tái)邊框?qū)?*/
          .console_box {
          background: #000000 url(Command_heading.jpg) no-repeat;
          width: 660px; /* windows 控制臺(tái)默認(rèn)寬度 */
          margin: 0px;
          padding-top: 23px; /* 控制臺(tái)標(biāo)題欄高度 */
          padding-right: 0px;
          padding-bottom: 0px;
          padding-left: 0px;
          border: 4px outset #FFFFFF;
          }

          /* 控制臺(tái)內(nèi)容層 */
          .console_box .console {
          background-color: #000000;
          font-family: "Courier New", Courier, "宋體", monospace;
          font-size: 12px;
          color: #CCCCCC;
          width: 656px;
          height: 396px;
          margin: 0px;
          padding: 0px;
          border: 2px inset #666666;
          overflow: auto; /* 自動(dòng)加入滾動(dòng)條 */
          }

          .console_box .console p {
          line-height: 120%;
          margin: 0px;
          padding-bottom: 1em; /* 段落下面留一空行的高度 */
          padding-top: 0px;
          padding-right: 0px;
          padding-left: 0px;
          }

          HTML

          <div class="console_box">
          <div class="console" style="height:200px;">
          <p>此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容此處顯示 class "console_box" 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          <p>此處顯示 class &quot;console_box&quot; 的內(nèi)容</p>
          </div>
          </div>

          可以在<div class="console" ...>中設(shè)置高度來(lái)設(shè)置控制臺(tái)的高度。

          后記

          一個(gè)控制臺(tái)的效果基本出來(lái)了。在IE6和Firefox中測(cè)試通過(guò)。還有工作可做

          • 為了區(qū)分控制臺(tái)中的輸入和輸出,建議用<kbd>和<samp>標(biāo)簽,并設(shè)置這寫(xiě)標(biāo)簽的CSS樣式。
          • 更改標(biāo)題欄圖標(biāo)和設(shè)置一下CSS樣式,就可以實(shí)現(xiàn)Linux或Mac等操作系統(tǒng)中的控制臺(tái)效果
          • 還有一些沒(méi)遇到和想到的問(wèn)題

          這是我第一次用Blog,還不知道上傳。這些源代碼和圖片的,請(qǐng)留下EMail,或等我熟悉了Blog再下載。

          posted on 2008-02-04 17:45 李四飛刀 閱讀(2139) 評(píng)論(11)  編輯  收藏 所屬分類: Blog面膜

          FeedBack:
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-04 19:48 QBomber
          3Q~
          quickbomber@gmail.com  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-05 09:04 如坐春風(fēng)
          頁(yè)面相當(dāng)漂亮啊。  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-07 00:50 李四飛刀
          @如坐春風(fēng)
          謝謝夸獎(jiǎng)  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-08 13:13 caike
          很不錯(cuò), 給我也發(fā)一份吧, jsnail#gmail.com
          thanks.  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-10 18:19 philodewer
          太感謝了,剛好需要這個(gè)。
          philodewATgmail.com  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果[未登錄](méi) 2008-02-13 11:15 fatbear
          good,想看看
          zhengwing2008@163.com  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-13 20:09 leson
          leson.zhu@gmail.com
          謝謝。  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-14 09:10 pover
          非常好,代理解決方案http://www.tgod.com.cn  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-15 09:08 wen
          retfu1@163.com,謝謝  回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-17 12:32 91cn33
          非常不錯(cuò)呀,收下了   回復(fù)  更多評(píng)論
            
          # re: CSS實(shí)現(xiàn)的控制臺(tái)效果 2008-02-19 18:58 lsqlister
          lsqlister@gmail.com ,謝謝  回復(fù)  更多評(píng)論
            

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 淮安市| 新河县| 义乌市| 阜新市| 谢通门县| 厦门市| 沧源| 南宫市| 体育| 介休市| 阿瓦提县| 棋牌| 易门县| 安庆市| 博野县| 双峰县| 平和县| 景谷| 台山市| 左权县| 荆门市| 巴林右旗| 张家界市| 临洮县| 松江区| 独山县| 江都市| 永福县| 边坝县| 南开区| 黄浦区| 开封县| 泾川县| 清原| 呼图壁县| 柏乡县| 彰化市| 琼结县| 遂宁市| 潜山县| 岢岚县|