CSS breadcrumbs Navigation bar 2 examples

Source: Internet
Author: User
Tags relative

Method One,

Note: This method uses CSS3, no pictures, compatible with a variety of WebKit browser, while compatible with ie8+. First figure:

1. First is the HTML code, relatively simple, only need a simple UL and Li can

The code is as follows

<div id= "Crumbs" >
<ul>
<li><a href= "#" > Home </a></li>
<li><a href= "#" > Directory </a></li>
<li><a href= "#" > subdirectory </a></li>
</ul>
<div class= "fixed" ></div>
</div>

2. Next is the CSS code, the first is to set the general Li Floating and a label beautification:

The code is as follows

#crumbs ul Li {
Float:left;
List-style:none;
}
#crumbs ul Li a {
Display:block;
Float:left;
height:34px;
Background: #f66fa2;
Text-align:center;
padding:10px 20px 0 45px;
position:relative;
margin:0 10px 0 0;
font-size:20px;
Text-decoration:none;
Color: #fff;
}

The next step is the key to breadcrumbs, creating arrow effects through before and after:

  code is as follows &nbs P;

#crumbs ul Li A:after {
content: "";
border-top:22px solid Transparent;
border-bottom:22px solid Transparent;
border-left:22px solid #f66fa2;
Position:absolute right: -22px; top:0;
Z-index:1;
}
#crumbs ul li A:before {
content: ";
border-top:22px solid Transparent;
border-bottom:22px solid Transparent;
border-left:22px solid #fff;
Position:absolute; left:0; top:0;
}
#crumbs ul li:first-child a {
border-top-left-radius:5px
border-bottom-left-radius:5px;
Padding -left:40px;
}
#crumbs ul li:first-child a:before {
Display:none;
}
#crumbs ul li:last-child a {
padding-right:30px;
border-top-right-radius:5px;
border-bottom-right-radius:5px;
}
#crumbs ul li:last-child a:after {
Display:none;
}
#crumbs ul li a:hover {
background: #e56592;
Transition:all 0.2s ease;
}
#crumbs ul li A:hover:after {
Border-left-color: #e56592;
Transition:all 0.2s ease;
}

Finally clear float:

The code is as follows

. Fixed {
Clear:both;
}

Method Two

The code is as follows

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

<meta http-equiv= " Content-type "content=" text/html; charset= "Utf-8″/>

<title> pure CSS make breadcrumbs, compatible ie6</title>

<style type=" Text/css "

*{margin:0;padding:0;list-style-type:none;}

a,img{border:0;}

body{font:12px/180% Arial, Helvetica, Sans-serif, "new song Body";}

/* Demo */

. demo{width:600px;margin:100px auto;background: #f0f0f0;p osition:relative;

. Demo Ul{height:32px;overflow:hidden;}

. Demo Li{float:left;width:200px;text-align:center;position:relative;z-index:2;font-weight:bold;font-size : 14px;line-height:32px;}

. Demo Li em{position:absolute;right:-24px;top:-8px;width:0;height:0;line-height:0;border-width:24px 0 24px 24px; Border-color:transparent Transparent TRansparent #fff; border-style:dashed dashed dashed solid;}

. Demo Li i{position:absolute;right:-16px;top:0;width:0;height:0;line-height:0;border-width:16px 0 16px 16px; Border-color:transparent transparent transparent #f0f0f0; border-style:dashed dashed dashed;}

. Demo Li.current{background: #f60; color: #fff; z-index:1;

. demo Li.current i{border-color:transparent transparent transparent #f60;}

</style>

<body>

<div class= "Demo"

<ul class= "Clearfix"

<li> bread crumbs one <em></em><i></i></li>

<li class= "current" > Crumb two <em></em><i></i></li>

<li> bread crumbs two <em></em><i></i></li>

</ul>

</div>
</body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.