DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> CSS入門知識 >> DIV十CSS布局 >> 布局實例
淘寶旺鋪側邊懸浮窗:CSS 與 HTML 設定流程
編輯:布局實例     

要在淘寶店鋪做一個固定在側邊的懸浮導航窗,流程其實不複雜,主要分兩塊:先寫 CSS,再貼 HTML。

步驟一:打開自訂編輯器

進入 U 站裝修,開啟「自定義編輯器」,你會看到兩個輸入欄——一個放 CSS,一個放 HTML。

步驟二:貼上 CSS

選擇 CSS 代碼編輯模式,把下面的內容貼進去。注意裡面的圖片網址是範例,請自行下載後依需要替換。

.link-tit {
  color: #5E3500; overflow: hidden; font-weight: normal;
  padding-left: 12px; height: 27px; font-size: 14px; line-height: 27px;
  background-color: #F2F5E4; background-repeat: repeat-x;
  text-align: left; display: block;
}
.brand a:hover {
  background-color: #EC017B; color: #FFF; text-decoration: none;
  border: 1px solid #F6D0B9;
  -webkit-border-radius: 2px; border-radius: 2px;
}
.brand { display: block; background-color: #FFF1D0; text-align: center; }
.menu-cate li a {
  font-size: 12px; line-height: 30px; height: 30px; display: block;
  color: #996A25; text-decoration: none; overflow: hidden;
  border-top: 1px dashed #E7CD9E; width: 132px;
}
.list li { list-style-type: none; }
.menu-cate li a i {
  float: left; margin-top: 6px; width: 20px; height: 18px;
  margin-right: 10px; background-repeat: no-repeat; display: none;
}
ul.category li a {
  color: #644B4F; padding-left: 0; text-align: center; display: block;
}
.bt {
  width: 137px; margin-left: 2px; height: 38px; cursor: default;
  background-image: url(你的圖片網址.png);
  background-repeat: repeat; background-position: -5px -315px;
}
.STYLE2 { color: #644B4F; }

步驟三:貼上 HTML

切到 HTML 編輯模式,貼入以下結構,同樣記得把 href 的 # 換成你的實際連結:

<div class="zdy_box4 cbu-iframe" style="width:137px;height:auto;z-index:10000000;
  top:100px;left:60px;padding-bottom:0px;color:#644B4F;font-size:12px;line-height:14px;">

  <ul style="margin:0;padding-left:0;list-style:none;">
    <li><img height="59" src="你的橫幅圖網址.png" width="137" /></li>
  </ul>

  <div style="background-color:#FFF;">
    <h2><a class="link-tit">快捷入口</a></h2>
    <ul class="menu-cate">
      <li class="brand"><a href="#">9塊9包郵專區</a></li>
      <li class="brand"><a href="#">精品女裝</a></li>
      <li class="brand"><a href="#" target="_self" title="">男裝</a></li>
      <li class="brand"><a href="#">包包</a></li>
      <li class="brand"><a href="#">鞋子</a></li>
      <li class="brand"><a href="#">配飾</a></li>
      <li class="brand"><a href="#">美容</a></li>
      <li class="brand"><a href="#" target="_self" title="">婚禮</a></li>
      <li class="brand"><a href="#">家居</a></li>
      <li class="brand"><a href="#">美食</a></li>
    </ul>

    <h2>
      <a class="link-tit" href="#" target="_blank"
        style="color:#000;margin:8px 0;display:block;">我是商家[我要報名]</a>
    </h2>
    <ul class="category">
      <li style="display:block;">
        <a href="#" target="_blank"><span>招商</span></a></li>
      <li style="margin:8px 0;display:block;">
        <a href="#" target="_blank"><span>幫派</span></a></li>
    </ul>

    客服 <a href="#" target="_blank">
      <img alt="點擊這裡給我發消息" border="0"
        src="你的客服圖示網址" /></a>

    <div class="love-site">
      <div align="center" class="dg-like-btn dg-like-site-btn sns-like sns-widget-ui simple-like" data-type="site">
        <div class="sns-like-wrap">
          <div align="center">
            <a class="dig-button" title="我的淘寶,大家一起贊!">
              <span class="dig-icon"></span>
              <span class="dig-button-title">喜歡小站[立即收藏]</span>
            </a>
          </div>
        </div>
      </div>

      <div align="center">
        <ul>
          <li style="display:block;"><a class="STYLE2" href="#" target="_blank">Ctrl+D</a></li>
          <li style="margin-top:8px;display:block;"><a class="STYLE2" href="#" target="_blank">收藏</a></li>
          <li style="margin-top:8px;"><a class="STYLE2" href="#">給我留言</a></li>
        </ul>
      </div>

      <div class="bt"></div>
    </div>
  </div>
</div>

幾點提醒

  • 最外層的 z-index:10000000 是為了壓過店鋪其他元素,數值給得很大比較保險。
  • 寬度 137px 是側欄常見尺寸,若要放寬記得同步調整 .menu-cate li a 的 width 與背景圖位置。
  • .bt 的 background-position:-5px -315px 是精靈圖的偏移量,換圖後必須重新計算。
  • 平台後台的支援程度時有變動,貼上後請務必在預覽頁面實際確認顯示狀況。
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved