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:
3
contents/_includes/patterns/full-background.njk
Normal file
3
contents/_includes/patterns/full-background.njk
Normal file
@@ -0,0 +1,3 @@
|
||||
<div class="full-background">
|
||||
{% lines "hor", 10 %}
|
||||
</div>
|
37
contents/full-background.md
Normal file
37
contents/full-background.md
Normal 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 %}
|
@@ -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>
|
||||
|
||||
|
Reference in New Issue
Block a user