1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-09 07:36:30 +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

126
contents/stepper-input.mdx Normal file
View File

@@ -0,0 +1,126 @@
---
category: Input
created: '2019-11-16'
description: Create a stepper input with CSS flexbox
keywords: css flexbox, css stepper input
thumbnail: /assets/css-layout/thumbnails/stepper-input.png
title: Stepper input
---
## HTML
```html
<div class="stepper-input">
<!-- Minus button -->
<button class="stepper-input__button">-</button>
<!-- Input container -->
<div class="stepper-input__content">
<input type="text" class="stepper-input__input" />
</div>
<!-- Plus button -->
<button class="stepper-input__button">+</button>
</div>
```
## CSS
```css
.stepper-input {
display: flex;
/* Border */
border: 1px solid #d1d5db;
border-radius: 0.25rem;
/* Size */
height: 2rem;
}
.stepper-input__button {
/* Reset */
background: #d1d5db;
border: none;
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
/* Size */
width: 2rem;
}
.stepper-input__content {
flex: 1;
}
.stepper-input__input {
/* Reset */
border: none;
/* Take full size of its container */
height: 100%;
width: 100%;
}
```
<Playground>
```css styles.css hidden
body {
align-items: center;
display: flex;
justify-content: center;
}
.stepper-input {
display: flex;
/* Border */
border: 1px solid #d1d5db;
border-radius: 0.25rem;
/* Size */
height: 2rem;
width: 16rem;
}
.stepper-input__button {
/* Reset */
background: #d1d5db;
border: none;
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
/* Size */
width: 2rem;
}
.stepper-input__content {
flex: 1;
}
.stepper-input__input {
/* Reset */
border: none;
/* Take full size of its container */
height: 100%;
width: 100%;
}
```
```html index.html hidden
<div class="stepper-input">
<button class="stepper-input__button">-</button>
<div class="stepper-input__content">
<input type="text" class="stepper-input__input" />
</div>
<button class="stepper-input__button">+</button>
</div>
```
</Playground>