DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> CSS入門知識 >> DIV十CSS布局 >> 布局實例
CSS+DIV 製作梯形不規則導航
編輯:布局實例     

梯形或不規則導航可以透過背景圖與浮動排列完成。核心概念是讓每個 li 使用固定寬度,並利用負 margin 讓相鄰項目靠近,形成連續的視覺形狀。

以下為示意圖:

CSS 概念

ul { list-style: none; width: 300px; margin: 20px auto; }
li { float: left; width: 86px; height: 25px; text-align: center; margin: 0 -5px; display: inline; }
a {
  float: left;
  width: 86px;
  height: 25px;
  background: url(/files/allimg/080407/2038022.gif) center center no-repeat;
}
a:hover {
  position: relative;
  background: url(/files/allimg/080407/2038021.gif) 0 0 no-repeat;
}

這種做法依賴背景圖本身的梯形外觀,CSS 主要負責排列與 hover 切換。若要更靈活,也可改用 clip-path、border-radius 或 SVG,但在純 CSS 的舊式專案中,背景圖仍是很直接的方案。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved