1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-18 11:51:28 +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

123
contents/slider.mdx Normal file
View File

@@ -0,0 +1,123 @@
---
category: Input
created: '2019-11-17'
description: Create a slider with CSS flexbox
keywords: css flexbox, css slider
thumbnail: /assets/css-layout/thumbnails/slider.png
title: Slider
---
## HTML
```html
<div class="slider">
<!-- Left side -->
<!-- Width based on the current value -->
<div class="slider__left" style="width: 20%"></div>
<!-- Circle -->
<div class="slider__circle"></div>
<!-- Right side -->
<div class="slider__right"></div>
</div>
```
## CSS
```css
.slider {
/* Content is centered horizontally */
align-items: center;
display: flex;
/* Size */
height: 2rem;
}
.slider__left {
height: 2px;
/* Colors */
background-color: #d1d5db;
}
.slider__circle {
/* Size */
height: 2rem;
width: 2rem;
/* Rounded border */
border-radius: 9999px;
/* Colors */
background-color: #3b82f6;
}
.slider__right {
/* Take the remaining width */
flex: 1;
height: 2px;
/* Colors */
background-color: #d1d5db;
}
```
<Playground>
```css styles.css hidden
body {
align-items: center;
display: flex;
justify-content: center;
}
.slider {
/* Content is centered horizontally */
align-items: center;
display: flex;
/* Size */
height: 2rem;
/* Demo */
width: 16rem;
}
.slider__left {
height: 2px;
/* Colors */
background-color: #d1d5db;
}
.slider__circle {
/* Size */
height: 2rem;
width: 2rem;
/* Rounded border */
border-radius: 9999px;
/* Colors */
background-color: #3b82f6;
}
.slider__right {
/* Take the remaining width */
flex: 1;
height: 2px;
/* Colors */
background-color: #d1d5db;
}
```
```html index.html hidden
<div class="slider">
<div class="slider__left" style="width: 20%"></div>
<div class="slider__circle"></div>
<div class="slider__right"></div>
</div>
```
</Playground>