1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-23 18:56:29 +02:00
Files
csslayout/contents/drawer.md
Phuoc Nguyen b7bd6a9d0a feat: Drawer
2022-09-21 15:36:23 +07:00

1007 B

layout, title, description, keywords
layout title description keywords
layouts/post.njk Drawer Create a drawer navigation with CSS css drawer, css off-canvas

This pattern is also known as off-canvas.

HTML

<div class="drawer">
    <!-- Backdrop -->
    <div class="drawer__overlay"></div>

    <!-- Sidebar -->
    <div class="drawer__sidebar">
        ...
    </div>
</div>

CSS

.drawer {
    /* Take full size */
    height: 100%;
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;

    z-index: 9999;
}

.drawer__overlay {
    /* Take full size */
    height: 100%;
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;

    /* User still can see the content of main page */
    background-color: rgba(0, 0, 0, 0.5);

    z-index: -1;
}

.drawer__sidebar {
    /* Take full height */
    height: 100%;
    left: 0;
    position: fixed;
    top: 0;
    width: 200px;

    /* Background */
    background-color: #fff;
}

{% demo %}{% include "covers/drawer.njk" %}{% enddemo %}