1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-09-08 21:30:50 +02:00

feat: Full background

This commit is contained in:
Phuoc Nguyen
2022-09-19 19:39:13 +07:00
parent ca08744f4d
commit 772d5b4f46
7 changed files with 60 additions and 109 deletions

View File

@@ -0,0 +1,3 @@
<div class="full-background">
{% lines "hor", 10 %}
</div>

View File

@@ -0,0 +1,37 @@
---
layout: layouts/post.njk
title: Full background
description: Create a full background element with CSS
keywords: css background size cover, css full background
---
## HTML
```html
<div class="full-background">
...
</div>
```
## CSS
```css
.full-background {
/* Center the content */
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
/* Take full size */
height: 100vh;
width: 100%;
/* Background */
background: url('/assets/full-background.jpeg') center center / cover no-repeat;
}
```
{% demo %}
{% include "patterns/full-background.njk" %}
{% enddemo %}

View File

@@ -151,6 +151,12 @@ eleventyExcludeFromCollections: true
<div class="pattern__title">Fixed at side</div>
</a>
</div>
<div class="pattern__item">
<a class="pattern__link" href="/full-background/">
<div class="pattern__cover">{% include "patterns/full-background.njk" %}</div>
<div class="pattern__title">Full background</div>
</a>
</div>
</div>
</div>