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

feat: Full screen menu

This commit is contained in:
Phuoc Nguyen
2022-09-22 08:50:23 +07:00
parent 310996b134
commit 28cf34bc7f
7 changed files with 122 additions and 195 deletions

View File

@@ -0,0 +1,4 @@
<div class="full-screen-menu">
{% lines "hor", 5 %}
<button type="button" class="full-screen-menu__close"></button>
</div>

View File

@@ -0,0 +1,49 @@
---
layout: layouts/post.njk
title: Full screen menu
description: Create a full screen menu with CSS flexbox
keywords: css fixed, css flexbox, css menu
---
## HTML
```html
<div class="full-screen-menu">
<!-- The navigation menu -->
<ul>
...
</ul>
<!-- The close button -->
<button type="button" class="full-screen-menu__close"></button>
</div>
```
## CSS
```css
.full-screen-menu {
/* Full screen overlay */
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
}
.full-screen-menu__close {
/* Shown at top left corner */
left: 1rem;
position: absolute;
top: 1rem;
}
```
You can use the [close button](/close-button/) to create a button for closing the menu.
{% demo %}{% include "covers/full-screen-menu.njk" %}{% enddemo %}

View File

@@ -129,6 +129,7 @@ eleventyExcludeFromCollections: true
{% pattern "Circular navigation" %}{% include "covers/circular-navigation.njk" %}{% endpattern %}
{% pattern "Dot navigation" %}{% include "covers/dot-navigation.njk" %}{% endpattern %}
{% pattern "Drawer" %}{% include "covers/drawer.njk" %}{% endpattern %}
{% pattern "Full screen menu" %}{% include "covers/full-screen-menu.njk" %}{% endpattern %}
{% pattern "Menu" %}{% include "covers/menu.njk" %}{% endpattern %}
{% pattern "Pagination" %}{% include "covers/pagination.njk" %}{% endpattern %}
{% pattern "Previous next buttons" %}{% include "covers/previous-next-buttons.njk" %}{% endpattern %}