CSS现实漂亮的面包屑_html/css_WEB-ITnose
关于css实现面包屑已经是一个典型例子了。不过今天还是与大家分享一下实现的原理。
原理:每一段元素固定宽度并向左浮动,头尾突出部分相对父元素用相对定位固定位置,默认为同一颜色,高亮设置指定样式。
<!doctype html><html lang="en"><head> <meta charset="UTF-8"> <title>面包屑</title> <style> *{margin: 0px;padding: 0px;} ul,ol,li,dl,dt,dd{list-style: none;} .iCls{*zoom:1;} .iCls:after{display:block; overflow:hidden;clear:both; height:0;visibility:hidden; content:".";} .iBread li i,.iBread li em,.iBread li strong{ background-image:url("http://images.cnblogs.com/cnblogs_com/kuikui/354173/o_ibread.png"); background-repeat: none; } .iBread{ width: 910px; margin: 20px auto; _overflow: hidden; } .iBread ul{ border-radius: 6px; overflow: hidden; } .iBread li{ position: relative; float: left; width: 292px; height: 35px; line-height: 35px; color: #666666; font-weight: bold; background: #dfdfdf; margin-right: 17px; _margin-right: 16px; text-indent: 80px; } .iBread li.last{ margin-right: 0px; } .iBread li i{ position: absolute; right: -17px; top: 0px; z-index: 1; display: block; width: 17px; height: 35px; overflow: hidden; background-position: -204px 0px; } .iBread li em{ display: none; } .iBread li strong{ position: absolute; left: 30px; top: 3px; display: block; width: 30px; height: 30px; overflow: hidden; text-indent: -9999px; margin-right: 20px; } .iBread li strong.one{ background-position: 0px 0px; } .iBread li strong.two{ background-position: -34px 0px; } .iBread li strong.three{ background-position: -67px 0px; } .iBread li strong.four{ background-position: -101px 0px; } .iBread li strong.five{ background-position: -134px 0px; } .iBread li.on{ z-index: 1; color: #fff; background-image:url("http://images.cnblogs.com/cnblogs_com/kuikui/354173/o_ibread.png"); background-repeat: repeat; background-position: 0px -78px; } .iBread li.on i{ right: -19px; width: 19px; color: #fff; background-position: -228px -41px; } .iBread li.on em,.iBread li.lastOn em{ position: absolute; left: -17px; top: 0px; z-index: 1; display: block; width: 17px; height: 35px; overflow: hidden; background-position: -204px -41px; } .iBread li.on strong.one{ background-position: 0px -41px; } .iBread li.on strong.two{ background-position: -34px -41px; } .iBread li.on strong.three{ background-position: -67px -41px; } .iBread li.on strong.four{ background-position: -101px -41px; } .iBread li.on strong.five{ background-position: -134px -41px; } .iBread li.last i{ background-position: -228px 0px; } .iBreadFour li{ width: 214.75px; } .iBreadFive li{ width: 168.4px; } </style></head><body> <div class="iBread"> <ul class="iCls"> <li class="on"> <strong class="one">1</strong> 第一项 <i></i> </li> <li> <strong class="two">2</strong> 第二项 <i></i><em></em> </li> <li class="last"> <strong class="three">3</strong> 第三项 <em></em> </li> </ul> </div> <div class="iBread iBreadFour"> <ul class="iCls"> <li class="on"> <strong class="one">1</strong> 第一项 <i></i> </li> <li> <strong class="two">2</strong> 第二项 <i></i><em></em> </li> <li > <strong class="three">3</strong> 第三项 <i></i><em></em> </li> <li class="last"> <strong class="four">4</strong> 第四项 <em></em> </li> </ul> </div> <div class="iBread iBreadFive"> <ul class="iCls"> <li > <strong class="one">1</strong> 第一项 <i></i> </li> <li class="on" > <strong class="two">2</strong> 第二项 <i></i><em></em> </li> <li > <strong class="three">3</strong> 第三项 <i></i><em></em> </li> <li> <strong class="four">4</strong> 第四项 <i></i><em></em> </li> <li class="last"> <strong class="five">5</strong> 第五项 <em></em> </li> </ul> </div></body></html>

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。

HTML、CSS和JavaScript在Web開發中的作用分別是:1.HTML定義網頁結構,2.CSS控製網頁樣式,3.JavaScript添加動態行為。它們共同構建了現代網站的框架、美觀和交互性。

HTML的未來趨勢是語義化和Web組件,CSS的未來趨勢是CSS-in-JS和CSSHoudini,JavaScript的未來趨勢是WebAssembly和Serverless。 1.HTML的語義化提高可訪問性和SEO效果,Web組件提升開發效率但需注意瀏覽器兼容性。 2.CSS-in-JS增強樣式管理靈活性但可能增大文件體積,CSSHoudini允許直接操作CSS渲染。 3.WebAssembly優化瀏覽器應用性能但學習曲線陡,Serverless簡化開發但需優化冷啟動問題。

HTML的未來充滿了無限可能。 1)新功能和標準將包括更多的語義化標籤和WebComponents的普及。 2)網頁設計趨勢將繼續向響應式和無障礙設計發展。 3)性能優化將通過響應式圖片加載和延遲加載技術提升用戶體驗。

HTML、CSS和JavaScript在網頁開發中的角色分別是:HTML負責內容結構,CSS負責樣式,JavaScript負責動態行為。 1.HTML通過標籤定義網頁結構和內容,確保語義化。 2.CSS通過選擇器和屬性控製網頁樣式,使其美觀易讀。 3.JavaScript通過腳本控製網頁行為,實現動態和交互功能。

HTML是構建網頁結構的基石。 1.HTML定義內容結構和語義,使用、、等標籤。 2.提供語義化標記,如、、等,提升SEO效果。 3.通過標籤實現用戶交互,需注意表單驗證。 4.使用、等高級元素結合JavaScript實現動態效果。 5.常見錯誤包括標籤未閉合和屬性值未加引號,需使用驗證工具。 6.優化策略包括減少HTTP請求、壓縮HTML、使用語義化標籤等。

HTML、CSS和JavaScript是構建現代網頁的核心技術:1.HTML定義網頁結構,2.CSS負責網頁外觀,3.JavaScript提供網頁動態和交互性,它們共同作用,打造出用戶體驗良好的網站。

HTMLISNOTAPROGRAMMENGUAGE; ITISAMARKUMARKUPLAGUAGE.1)htmlStructures andFormatSwebContentusingtags.2)itworkswithcsssforstylingandjavascript for Interactivity,增強WebevebDevelopment。
