mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-31 09:31:43 +02:00
feat: Breadcrumb
This commit is contained in:
6
contents/_includes/covers/breadcrumb.njk
Normal file
6
contents/_includes/covers/breadcrumb.njk
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="breadcrumb">
|
||||
<div class="breadcrumb__item">A</div>
|
||||
<div class="breadcrumb__item">B</div>
|
||||
<div class="breadcrumb__item">C</div>
|
||||
<div class="breadcrumb__item">D</div>
|
||||
</div>
|
47
contents/breadcrumb.md
Normal file
47
contents/breadcrumb.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
layout: layouts/post.njk
|
||||
title: Breadcrumb
|
||||
description: Create a breadcrumb with CSS flexbox
|
||||
keywords: css breadcrumb, css flexbox
|
||||
---
|
||||
|
||||
## HTML
|
||||
|
||||
```html
|
||||
<div class="breadcrumb">
|
||||
<!-- Breadcrumb item -->
|
||||
<div class="breadcrumb__item">...</div>
|
||||
|
||||
<!-- Repeat other items -->
|
||||
...
|
||||
</div>
|
||||
```
|
||||
|
||||
## CSS
|
||||
|
||||
```css
|
||||
.breadcrumb {
|
||||
/* Content is centered vertically */
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.breadcrumb__item {
|
||||
margin: 0 0.5rem;
|
||||
|
||||
/* Used to position the separator between items */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.breadcrumb__item:not(:last-child)::after {
|
||||
/* Absolute position */
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
transform: translate(0.5rem, 0px);
|
||||
|
||||
content: '/';
|
||||
}
|
||||
```
|
||||
|
||||
{% demo %}{% include "covers/breadcrumb.njk" %}{% enddemo %}
|
@@ -122,5 +122,12 @@ eleventyExcludeFromCollections: true
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="category">
|
||||
<h2 class="category__name">Navigation</h2>
|
||||
<div class="category__posts">
|
||||
{% pattern "Breadcrumb" %}{% include "covers/breadcrumb.njk" %}{% endpattern %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "follow.njk" %}
|
||||
</div>
|
Reference in New Issue
Block a user