CSS part4
CSS Basics
Introduction to CSS Part4
In this lesson we covered the concept of using breadcrumbs as a secondary navigation method for a site:
- Use breadcrumbs to indicate where a user is and the extent of the site
- Breadcrumbs are implemented using unordered lists in HTML with custom CSS styling
- Three types of breadcrumbs exist:
- location - based on hierarchical structure of site
- attribute - based on attributes of current page or item
- path - unique to a user’s journey on the site
- Path-based breadcrumbs can be confusing, only use if needed
- Ensure breadcrumbs will add value before adding to a site
Example:
.breadcrumb li{
display: inline;
}
.breadcrumb li.location+li.location::before{
padding:10px;
color:blue;
content: ">"
}
.breadcrumb a:hover{
text-decoration: underline;
}
.breadcrumb li.attribute a {
color: gray;
}
.breadcrumb li.attribute::after {
content: "x";
color: red;
font-size: 10px;
vertical-align: super;
}
making arrows of breadcrumbs:
.breadcrumb {
text-align: left;
}
// ................................. making the body of the arrow:
.breadcrumb li {
float: left;
}
.breadcrumb a {
color: #fff;
background: darkcyan;
text-decoration: none;
position: relative;
height: 30px;
line-height: 30px;
text-align: center;
margin-right: 15px;
padding: 0 5px;
}
// ...................................... making it an arrow:
.breadcrumb a::before,
.breadcrumb a::after {
content: "";
position: absolute;
border-color: darkcyan;
border-style: solid;
border-width: 15px 5px;
}
.breadcrumb a::before {
left: -10px;
border-left-color: transparent;
}
.breadcrumb a::after {
left: 100%;
}
.breadcrumb a::after {
left: 100%;
border-color: transparent;
border-left-color: darkcyan;
}
// ................................. styling
.breadcrumb a:hover {
background-color: blue;
}
.breadcrumb a:hover::before {
border-color: blue;
border-left-color: transparent;
}
.breadcrumb a:hover::after {
border-left-color: blue;
}