1
0
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:
Phuoc Nguyen
2022-09-21 14:44:30 +07:00
parent d166d682ea
commit 638f0c0df0
7 changed files with 81 additions and 126 deletions

View 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
View 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 %}

View File

@@ -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>