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

feat: Update contents

This commit is contained in:
Phuoc Nguyen
2023-08-19 19:27:15 +07:00
parent f7af6da9e4
commit 71d51b358a
318 changed files with 15536 additions and 6884 deletions

116
contents/layered-card.mdx Normal file
View File

@@ -0,0 +1,116 @@
---
category: Display
created: '2021-04-04'
description: Create a layered card with CSS
keywords: css layered card
thumbnail: /assets/css-layout/thumbnails/layered-card.png
title: Layered card
---
## HTML
```html
<div class="layered-card">
<div class="layered-card__content"></div>
</div>
```
## CSS
```css
.layered-card {
position: relative;
/* Demo */
height: 6rem;
width: 6rem;
}
.layered-card::before {
background: #d1d5db;
content: '';
/* Position */
top: 0;
left: 0;
position: absolute;
transform: translate(1rem, 1rem);
/* Size */
height: 100%;
width: 100%;
/* Display under the main content */
z-index: 0;
}
.layered-card__content {
/* Position */
left: 0;
position: absolute;
top: 0;
/* Size */
height: 100%;
width: 100%;
z-index: 1;
background: #fff;
}
```
<Playground>
```css styles.css hidden
body {
align-items: center;
display: flex;
justify-content: center;
}
.layered-card {
position: relative;
/* Demo */
height: 6rem;
width: 6rem;
}
.layered-card::before {
background: #d1d5db;
content: '';
/* Position */
top: 0;
left: 0;
position: absolute;
transform: translate(1rem, 1rem);
/* Size */
height: 100%;
width: 100%;
/* Display under the main content */
z-index: 0;
}
.layered-card__content {
left: 0;
position: absolute;
top: 0;
/* Size */
height: 100%;
width: 100%;
z-index: 1;
border: 1px solid #d1d5db;
background: #fff;
}
```
```html index.html hidden
<div class="layered-card">
<div class="layered-card__content"></div>
</div>
```
</Playground>