html+css3实现扁平化面包屑导航

 时间:2026-02-12 08:32:24

1、新建html文档。

html+css3实现扁平化面包屑导航

2、书写hmtl代码。

<h1>html+css3实现扁平化面包屑导航</h1>

<ul id="breadcrumb">

 <li><a href="#"><span class="icon icon-home"> </span></a></li>

 <li><a href="#"><span class="icon icon-beaker"> </span> Projects</a></li>

 <li><a href="#"><span class="icon icon-double-angle-right"></span> Breadcrumb</a></li>

 <li><a href="#"><span class="icon icon-rocket"> </span> Getting started</a></li>

 <li><a href="#"><span class="icon icon-arrow-down"> </span> Download</a></li>

 <li><a href="#"><span class="icon icon-arrow-down"> </span> Download</a></li>

</ul>

html+css3实现扁平化面包屑导航

3、书写css代码。

<style>

* { margin: 0; padding: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 12px; }

body { text-align: center; background-color: #34495e; }

h1 { font-weight: 100; font-size: 32px; padding: 40px; color: #fff; }

#breadcrumb { list-style: none; display: inline-block; }

#breadcrumb .icon { font-size: 14px; }

#breadcrumb li { float: left; }

#breadcrumb li a { color: #FFF; display: block; background: #3498db; text-decoration: none; position: relative; height: 40px; line-height: 40px; padding: 0 10px 0 5px; text-align: center; margin-right: 23px; }

#breadcrumb li:nth-child(even) a { background-color: #2980b9; }

#breadcrumb li:nth-child(even) a:before { border-color: #2980b9; border-left-color: transparent; }

#breadcrumb li:nth-child(even) a:after { border-left-color: #2980b9; }

#breadcrumb li:first-child a { padding-left: 15px; -webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; -ms-border-radius: 4px 0 0 4px; -o-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px; }

#breadcrumb li:first-child a:before { border: none; }

#breadcrumb li:last-child a { padding-right: 15px; -webkit-border-radius: 0 4px 4px 0; -moz-border-radius: 0 4px 4px 0; -ms-border-radius: 0 4px 4px 0; -o-border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0; }

#breadcrumb li:last-child a:after { border: none; }

#breadcrumb li a:before, #breadcrumb li a:after { content: ""; position: absolute; top: 0; border: 0 solid #3498db; border-width: 20px 10px; width: 0; height: 0; }

#breadcrumb li a:before { left: -20px; border-left-color: transparent; }

#breadcrumb li a:after { left: 100%; border-color: transparent; border-left-color: #3498db; }

#breadcrumb li a:hover { background-color: #1abc9c; }

#breadcrumb li a:hover:before { border-color: #1abc9c; border-left-color: transparent; }

#breadcrumb li a:hover:after { border-left-color: #1abc9c; }

#breadcrumb li a:active { background-color: #16a085; }

#breadcrumb li a:active:before { border-color: #16a085; border-left-color: transparent; }

#breadcrumb li a:active:after { border-left-color: #16a085; }

</style>

html+css3实现扁平化面包屑导航

4、代码整体结构

html+css3实现扁平化面包屑导航

5、查看效果

html+css3实现扁平化面包屑导航

html+css3实现扁平化面包屑导航

  • 图解利用HBuilder开发Web项目
  • Kali Linux工作区如何重命名
  • 如何在车站快速购票——巴士管家小程序使用指南
  • 搜狗浏览器怎么开启启动恢复未关闭网页?
  • clαp怎么发音
  • 热门搜索
    oppo手机怎么录屏 人参怎么吃效果最好 南瓜羹的做法 獾怎么读 萝卜丸子的家常做法 羊肉饺子馅的做法 火锅做法 瑶柱粥的做法 溜肥肠的做法 糖醋小排的家常做法