1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-04 13:17:48 +02:00

Merge pull request #217 from phuocng/progress-bar

feat: Indeterminate progress bar
This commit is contained in:
phuocng
2022-10-02 17:38:02 +07:00
committed by GitHub
177 changed files with 399 additions and 476 deletions

View File

@@ -2,17 +2,17 @@
A collection of popular layouts and patterns made with CSS: A collection of popular layouts and patterns made with CSS:
* 🎉 Zero dependencies - 🎉 Zero dependencies
* 🎉 No frameworks - 🎉 No frameworks
* 🎉 No CSS hacks - 🎉 No CSS hacks
* 🎉 Real use cases - 🎉 Real use cases
* Good practices (coming soon) - Good practices (coming soon)
* Accessibility Support (coming soon) - Accessibility Support (coming soon)
## Why ## Why
Being a front-end engineer, I have to deal with a lot of layouts and components. Being a front-end engineer, I have to deal with a lot of layouts and components.
There are a lot of CSS frameworks out there that provide popular layouts/components but There are a lot of CSS frameworks out there that provide popular layouts/components but
I usually don't want to include all of them in my project. I usually don't want to include all of them in my project.
So I collect most popular layouts and components that can be built with pure CSS. So I collect most popular layouts and components that can be built with pure CSS.
@@ -23,20 +23,20 @@ By composing them, you can have any possible layout that exists in the real life
## Running it on local ## Running it on local
- Clone the project: - Clone the project:
```shell ```shell
$ git clone https://github.com/phuocng/csslayout $ git clone https://github.com/phuocng/csslayout
``` ```
- Install the dependencies: - Install the dependencies:
```shell ```shell
$ cd csslayout $ cd csslayout
$ npm install $ npm install
``` ```
- Run it on the local: - Run it on the local:
```shell ```shell
$ npm run start $ npm run start
@@ -61,6 +61,7 @@ If there is any issue, it will be logged in the `tslint.log` file.
This project is developed by _Nguyen Huu Phuoc_. I love building products and sharing knowledge. This project is developed by _Nguyen Huu Phuoc_. I love building products and sharing knowledge.
Be my friend on Be my friend on
* [Twitter](https://twitter.com/nghuuphuoc)
* [dev.to](https://dev.to/phuocng) - [Twitter](https://twitter.com/nghuuphuoc)
* [Github](https://github.com/phuoc-ng) - [dev.to](https://dev.to/phuocng)
- [Github](https://github.com/phuoc-ng)

View File

@@ -0,0 +1,3 @@
<div class="indeterminate-progress-bar">
<div class="indeterminate-progress-bar__progress"></div>
</div>

View File

@@ -18,21 +18,15 @@ keywords: css accordion, css flexbox
<div class="accordion__toggle">...</div> <div class="accordion__toggle">...</div>
<!-- The title --> <!-- The title -->
<div class="accordion__title"> <div class="accordion__title">...</div>
...
</div>
</div> </div>
<!-- The content --> <!-- The content -->
<div class="accordion__content"> <div class="accordion__content">...</div>
...
</div>
</div> </div>
<!-- Expanded item --> <!-- Expanded item -->
<div class="accordion__item accordion__item--expanded"> <div class="accordion__item accordion__item--expanded">...</div>
...
</div>
<!-- Repeat other item --> <!-- Repeat other item -->
... ...

View File

@@ -8,9 +8,7 @@ keywords: css badge, css flexbox
## HTML ## HTML
```html ```html
<div class="badge"> <div class="badge">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -20,7 +20,7 @@ keywords: css box selector
.box-selector { .box-selector {
border: 1px solid #d1d5db; border: 1px solid #d1d5db;
border-radius: 0.25rem; border-radius: 0.25rem;
padding: .5rem; padding: 0.5rem;
} }
.box-selector--selected { .box-selector--selected {
@@ -54,5 +54,5 @@ keywords: css box selector
## See also ## See also
- [Custom checkbox button](/custom-checkbox-button/) - [Custom checkbox button](/custom-checkbox-button/)
- [Custom radio button](/custom-radio-button/) - [Custom radio button](/custom-radio-button/)

View File

@@ -40,7 +40,7 @@ keywords: css breadcrumb, css flexbox
top: 0; top: 0;
transform: translate(0.5rem, 0px); transform: translate(0.5rem, 0px);
content: '/'; content: '/';
} }
``` ```

View File

@@ -13,9 +13,7 @@ keywords: css flexbox, css icon button
... ...
<!-- Label --> <!-- Label -->
<div class="button-with-icon__label"> <div class="button-with-icon__label">...</div>
...
</div>
</button> </button>
``` ```

View File

@@ -17,11 +17,11 @@ keywords: css calendar, css grid
<div class="calendar__weekday">Fri</div> <div class="calendar__weekday">Fri</div>
<div class="calendar__weekday">Sat</div> <div class="calendar__weekday">Sat</div>
<div class="calendar__weekday">Sun</div> <div class="calendar__weekday">Sun</div>
<!-- Days of the previous month --> <!-- Days of the previous month -->
<div class="calendar__day calendar__day--disabled">30</div> <div class="calendar__day calendar__day--disabled">30</div>
<div class="calendar__day calendar__day--disabled">31</div> <div class="calendar__day calendar__day--disabled">31</div>
<!-- Days of the current month --> <!-- Days of the current month -->
<div class="calendar__day">1</div> <div class="calendar__day">1</div>
<div class="calendar__day">2</div> <div class="calendar__day">2</div>
@@ -60,12 +60,12 @@ keywords: css calendar, css grid
color: #fff; color: #fff;
} }
.calendar__day:nth-child(7n+1) { .calendar__day:nth-child(7n + 1) {
border-left: 1px solid #d1d5db; border-left: 1px solid #d1d5db;
} }
.calendar__day--disabled { .calendar__day--disabled {
color: #d1d5db; color: #d1d5db;
} }
``` ```

View File

@@ -10,9 +10,7 @@ keywords: css card layout, css flexbox, css layout
```html ```html
<div class="card-layout"> <div class="card-layout">
<!-- A card with given width --> <!-- A card with given width -->
<div class="card-layout__item"> <div class="card-layout__item">...</div>
...
</div>
<!-- Repeat other cards --> <!-- Repeat other cards -->
... ...

View File

@@ -10,14 +10,10 @@ keywords: css card, css flexbox
```html ```html
<div class="card"> <div class="card">
<!-- Cover --> <!-- Cover -->
<div class="card__cover"> <div class="card__cover">...</div>
...
</div>
<!-- Content --> <!-- Content -->
<div class="card__content"> <div class="card__content">...</div>
...
</div>
... ...
</div> </div>
``` ```

View File

@@ -8,9 +8,7 @@ keywords: css centering, css flexbox
## HTML ## HTML
```html ```html
<div class="centering"> <div class="centering">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -10,9 +10,7 @@ keywords: css chip, css flexbox, css tag
```html ```html
<div class="chip"> <div class="chip">
<!-- Content --> <!-- Content -->
<div class="chip__content"> <div class="chip__content">...</div>
...
</div>
<!-- The close button --> <!-- The close button -->
<button class="chip__button"> <button class="chip__button">

View File

@@ -15,9 +15,7 @@ keywords: css circular navigation, css flexbox
<!-- A circle menu item --> <!-- A circle menu item -->
<div class="circular-navigation__circle"> <div class="circular-navigation__circle">
<!-- The content --> <!-- The content -->
<div class="circular-navigation__content"> <div class="circular-navigation__content">...</div>
...
</div>
</div> </div>
<!-- Repeat menu items --> <!-- Repeat menu items -->

View File

@@ -10,9 +10,7 @@ keywords: css cookie banner, css flexbox
```html ```html
<div class="cookie-banner"> <div class="cookie-banner">
<!-- Tells visitors that the website uses cookie --> <!-- Tells visitors that the website uses cookie -->
<div class="cookie-banner__content"> <div class="cookie-banner__content">...</div>
...
</div>
<!-- Close button --> <!-- Close button -->
... ...

View File

@@ -12,8 +12,7 @@ keywords: css flexbox, css ribbon
<!-- The container --> <!-- The container -->
<div class="corner-ribbon__inner"> <div class="corner-ribbon__inner">
<!-- The ribbon --> <!-- The ribbon -->
<div class="corner-ribbon__ribbon"> <div class="corner-ribbon__ribbon"></div>
</div>
</div> </div>
</div> </div>
``` ```

View File

@@ -66,5 +66,5 @@ keywords: css checkbox, css flexbox
## See also ## See also
- [Box selector](/box-selector/) - [Box selector](/box-selector/)
- [Custom radio button](/custom-radio-button/) - [Custom radio button](/custom-radio-button/)

View File

@@ -70,5 +70,5 @@ keywords: css flexbox, css radio
## See also ## See also
- [Box selector](/box-selector/) - [Box selector](/box-selector/)
- [Custom checkbox button](/custom-checkbox-button/) - [Custom checkbox button](/custom-checkbox-button/)

View File

@@ -15,9 +15,7 @@ This pattern is also known as off-canvas.
<div class="drawer__overlay"></div> <div class="drawer__overlay"></div>
<!-- Sidebar --> <!-- Sidebar -->
<div class="drawer__sidebar"> <div class="drawer__sidebar">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -8,9 +8,7 @@ keywords: css dropping area, css flexbox
## HTML ## HTML
```html ```html
<div class="drop-area"> <div class="drop-area">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -8,9 +8,7 @@ keywords: css drop cap, css :first-letter
## HTML ## HTML
```html ```html
<div class="drop-cap"> <div class="drop-cap">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -10,21 +10,17 @@ keywords: css dropdown, css menu
```html ```html
<div class="dropdown"> <div class="dropdown">
<!-- The trigger element --> <!-- The trigger element -->
<div class="dropdown__trigger"> <div class="dropdown__trigger">...</div>
...
</div>
<!-- The content --> <!-- The content -->
<div class="dropdown__content"> <div class="dropdown__content">...</div>
...
</div>
</div> </div>
``` ```
## CSS ## CSS
```css ```css
.dropdown { .dropdown {
position: relative; position: relative;
} }

View File

@@ -12,9 +12,7 @@ The pattern is often used to indicate there is more content.
```html ```html
<div class="fading-long-section"> <div class="fading-long-section">
<!-- Main content --> <!-- Main content -->
<div class="fading-long-section__content"> <div class="fading-long-section__content">...</div>
...
</div>
<!-- The faded element --> <!-- The faded element -->
<div class="fading-long-section__fading"></div> <div class="fading-long-section__fading"></div>

View File

@@ -10,9 +10,7 @@ keywords: css feature comparison, css flexbox
```html ```html
<div class="feature-comparison"> <div class="feature-comparison">
<!-- Feature name --> <!-- Feature name -->
<div class="feature-comparison__feature"> <div class="feature-comparison__feature">...</div>
...
</div>
<!-- The model --> <!-- The model -->
<div class="feature-comparison__model"> <div class="feature-comparison__model">

View File

@@ -11,14 +11,10 @@ keywords: css feature list, css flexbox
<!-- Feature item --> <!-- Feature item -->
<div class="feature-list"> <div class="feature-list">
<!-- Image --> <!-- Image -->
<div class="feature-list__image"> <div class="feature-list__image">...</div>
...
</div>
<!-- Right side --> <!-- Right side -->
<div class="feature-list__desc"> <div class="feature-list__desc">...</div>
...
</div>
</div> </div>
<!-- Repeated items --> <!-- Repeated items -->

View File

@@ -10,24 +10,16 @@ keywords: css fixed
```html ```html
<div class="fixed-at-corner"> <div class="fixed-at-corner">
<!-- Top-left corner --> <!-- Top-left corner -->
<div class="fixed-at-corner__corner fixed-at-corner__corner--tl"> <div class="fixed-at-corner__corner fixed-at-corner__corner--tl">...</div>
...
</div>
<!-- Top-right corner --> <!-- Top-right corner -->
<div class="fixed-at-corner__corner fixed-at-corner__corner--tr"> <div class="fixed-at-corner__corner fixed-at-corner__corner--tr">...</div>
...
</div>
<!-- Bottom-right corner --> <!-- Bottom-right corner -->
<div class="fixed-at-corner__corner fixed-at-corner__corner--br"> <div class="fixed-at-corner__corner fixed-at-corner__corner--br">...</div>
...
</div>
<!-- Bottom-left corner --> <!-- Bottom-left corner -->
<div class="fixed-at-corner__corner fixed-at-corner__corner--bl"> <div class="fixed-at-corner__corner fixed-at-corner__corner--bl">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -9,14 +9,10 @@ keywords: css fixed
```html ```html
<!-- Fixed at the middle of left side --> <!-- Fixed at the middle of left side -->
<div class="fixed-at-side fixed-at-side--l"> <div class="fixed-at-side fixed-at-side--l">...</div>
...
</div>
<!-- Fixed at the middle of right side --> <!-- Fixed at the middle of right side -->
<div class="fixed-at-side fixed-at-side--r"> <div class="fixed-at-side fixed-at-side--r">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -31,7 +31,7 @@ keywords: css folder structure, css folder tree
... ...
</ul> </ul>
</li> </li>
<!-- Repeat other items --> <!-- Repeat other items -->
... ...
</ul> </ul>
@@ -88,9 +88,7 @@ keywords: css folder structure, css folder tree
/* Remove the border from the last item */ /* Remove the border from the last item */
.folder-structure li:last-child::before { .folder-structure li:last-child::before {
height: calc( height: calc(var(--folder-structure-item-padding-top) + var(--folder-structure-item-height) / 2);
var(--folder-structure-item-padding-top) + var(--folder-structure-item-height) / 2
);
} }
``` ```

View File

@@ -8,9 +8,7 @@ keywords: css background size cover, css full background
## HTML ## HTML
```html ```html
<div class="full-background"> <div class="full-background">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -39,7 +39,7 @@ keywords: css fixed, css flexbox, css menu
.full-screen-menu__close { .full-screen-menu__close {
/* Shown at top left corner */ /* Shown at top left corner */
left: 1rem; left: 1rem;
position: absolute; position: absolute;
top: 1rem; top: 1rem;
} }
``` ```

View File

@@ -9,9 +9,7 @@ keywords: css flexbox, css holy grail layout, css layout
```html ```html
<div class="holy-grail"> <div class="holy-grail">
<header> <header>...</header>
...
</header>
<main class="holy-grail__main"> <main class="holy-grail__main">
<!-- Left sidebar --> <!-- Left sidebar -->
<aside class="holy-grail__left">...</aside> <aside class="holy-grail__left">...</aside>
@@ -22,9 +20,7 @@ keywords: css flexbox, css holy grail layout, css layout
<!-- Right sidebar --> <!-- Right sidebar -->
<nav class="holy-grail__right">...</nav> <nav class="holy-grail__right">...</nav>
</main> </main>
<footer> <footer>...</footer>
...
</footer>
</div> </div>
``` ```

View File

@@ -0,0 +1,66 @@
---
layout: layouts/post.njk
title: Indeterminate progress bar
description: Create an indeterminate progress bar with CSS
keywords: css indeterminate progress bar, css progress bar
---
## HTML
```html
<div class="indeterminate-progress-bar">
<div class="indeterminate-progress-bar__progress"></div>
</div>
```
## CSS
```css
.indeterminate-progress-bar {
/* Color */
background-color: #d1d5db;
/* Rounded border */
border-radius: 9999px;
/* Size */
height: 0.5rem;
position: relative;
overflow: hidden;
}
.indeterminate-progress-bar__progress {
/* Color */
background-color: #3b82f6;
/* Rounded border */
border-radius: 9999px;
/* Absolute position */
position: absolute;
bottom: 0;
top: 0;
width: 50%;
/* Move the bar infinitely */
animation-duration: 2s;
animation-iteration-count: infinite;
animation-name: indeterminate-progress-bar;
}
@keyframes indeterminate-progress-bar {
from {
left: -50%;
}
to {
left: 100%;
}
}
```
{% demo %}{% include "covers/indeterminate-progress-bar.njk" %}{% enddemo %}
## See also
- [Progress bar](/progress-bar/)

View File

@@ -77,6 +77,7 @@ eleventyExcludeFromCollections: true
<div class="category"> <div class="category">
<h2 class="category__name">Feedback</h2> <h2 class="category__name">Feedback</h2>
<div class="category__posts"> <div class="category__posts">
{% pattern "Indeterminate progress bar" %}{% include "covers/indeterminate-progress-bar.njk" %}{% endpattern %}
{% pattern "Modal" %}{% include "covers/modal.njk" %}{% endpattern %} {% pattern "Modal" %}{% include "covers/modal.njk" %}{% endpattern %}
{% pattern "Notification" %}{% include "covers/notification.njk" %}{% endpattern %} {% pattern "Notification" %}{% include "covers/notification.njk" %}{% endpattern %}
{% pattern "Popover arrow" %}{% include "covers/popover-arrow.njk" %}{% endpattern %} {% pattern "Popover arrow" %}{% include "covers/popover-arrow.njk" %}{% endpattern %}

View File

@@ -8,9 +8,7 @@ keywords: css avatar
## HTML ## HTML
```html ```html
<div class="initial-avatar"> <div class="initial-avatar">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -11,9 +11,7 @@ keywords: css flexbox, css input add-on
<!-- Add-on prepended --> <!-- Add-on prepended -->
<div class="input-addon"> <div class="input-addon">
<!-- Add-on --> <!-- Add-on -->
<div class="input-addon__addon input-addon__addon--prepended"> <div class="input-addon__addon input-addon__addon--prepended">...</div>
...
</div>
<!-- Input --> <!-- Input -->
<input type="text" class="input-addon__input" /> <input type="text" class="input-addon__input" />
@@ -25,25 +23,19 @@ keywords: css flexbox, css input add-on
<input type="text" class="input-addon__input" /> <input type="text" class="input-addon__input" />
<!-- Add-on --> <!-- Add-on -->
<div class="input-addon__addon input-addon__addon--appended"> <div class="input-addon__addon input-addon__addon--appended">...</div>
...
</div>
</div> </div>
<!-- Appended and prepended add-ons --> <!-- Appended and prepended add-ons -->
<div class="input-addon"> <div class="input-addon">
<!-- Add-on --> <!-- Add-on -->
<div class="input-addon__addon input-addon__addon--prepended"> <div class="input-addon__addon input-addon__addon--prepended">...</div>
...
</div>
<!-- Input --> <!-- Input -->
<input type="text" class="input-addon__input" /> <input type="text" class="input-addon__input" />
<!-- Add-on --> <!-- Add-on -->
<div class="input-addon__addon input-addon__addon--appended"> <div class="input-addon__addon input-addon__addon--appended">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -8,9 +8,7 @@ keywords: css border radius, css inverted border radius, css inverted corners
## HTML ## HTML
```html ```html
<div class="inverted-corners"> <div class="inverted-corners">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -51,10 +51,10 @@ keywords: css layered card
/* Size */ /* Size */
height: 100%; height: 100%;
width: 100%; width: 100%;
z-index: 1; z-index: 1;
background: #FFF; background: #fff;
} }
``` ```

View File

@@ -8,9 +8,7 @@ keywords: css linear gradient, css lined paper, css multiple horizontal lines
## HTML ## HTML
```html ```html
<div class="lined-paper"> <div class="lined-paper">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -10,13 +10,9 @@ keywords: css flexbox, media object
```html ```html
<div class="media-object"> <div class="media-object">
<!-- Media object --> <!-- Media object -->
<div class="media-object__media"> <div class="media-object__media">...</div>
...
</div>
<!-- Main content --> <!-- Main content -->
<div class="media-object__content"> <div class="media-object__content">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -18,9 +18,7 @@ keywords: css mega menu
<div>...</div> <div>...</div>
<!-- Mega menu --> <!-- Mega menu -->
<div class="mega-menu__content"> <div class="mega-menu__content">...</div>
...
</div>
</div> </div>
<!-- Item --> <!-- Item -->

View File

@@ -10,18 +10,14 @@ keywords: css flexbox, css menu
```html ```html
<div class="menu"> <div class="menu">
<!-- Normal menu item --> <!-- Normal menu item -->
<div class="menu__item"> <div class="menu__item">...</div>
...
</div>
<!-- With hot key --> <!-- With hot key -->
<div class="menu__item"> <div class="menu__item">
<!-- Label --> <!-- Label -->
... ...
<!-- Hot key --> <!-- Hot key -->
<div class="menu__hotkey"> <div class="menu__hotkey">...</div>
...
</div>
</div> </div>
<!-- With image and hot key --> <!-- With image and hot key -->
@@ -33,9 +29,7 @@ keywords: css flexbox, css menu
... ...
<!-- Hot key --> <!-- Hot key -->
<div class="menu__hotkey"> <div class="menu__hotkey">...</div>
...
</div>
</div> </div>
<!-- Divider --> <!-- Divider -->

View File

@@ -21,9 +21,7 @@ keywords: css dialog, css flexbox, css modal
... ...
<!-- Footer --> <!-- Footer -->
<div class="modal__footer"> <div class="modal__footer">...</div>
...
</div>
</div> </div>
``` ```
@@ -48,7 +46,7 @@ keywords: css dialog, css flexbox, css modal
display: flex; display: flex;
/* Push the buttons to the right */ /* Push the buttons to the right */
justify-content: flex-end; justify-content: flex-end;
/* Border */ /* Border */
border-top: 1px solid #d1d5db; border-top: 1px solid #d1d5db;
} }

View File

@@ -12,7 +12,8 @@ keywords: css dropdown menu, css multi-level dropdown menu, css nested dropdown
<li>A</li> <li>A</li>
<li> <li>
<div class="nested-dropdowns__item"> <div class="nested-dropdowns__item">
B <div class="nested-dropdowns__arrow">...</div> B
<div class="nested-dropdowns__arrow">...</div>
</div> </div>
<ul> <ul>
<li>B.1</li> <li>B.1</li>
@@ -54,7 +55,7 @@ keywords: css dropdown menu, css multi-level dropdown menu, css nested dropdown
.nested-dropdowns li { .nested-dropdowns li {
cursor: pointer; cursor: pointer;
/* Spacing */ /* Spacing */
padding: 0.25rem; padding: 0.25rem;

View File

@@ -10,9 +10,7 @@ keywords: css alert, css flexbox, css notification
```html ```html
<div class="notification"> <div class="notification">
<!-- Content --> <!-- Content -->
<div class="notification__body"> <div class="notification__body">...</div>
...
</div>
<!-- Close button --> <!-- Close button -->
<button class="notification__close"> <button class="notification__close">

View File

@@ -15,9 +15,7 @@ keywords: css flexbox
<!-- The overlay area --> <!-- The overlay area -->
<div class="overlay-play-button__overlay"> <div class="overlay-play-button__overlay">
<!-- The player button --> <!-- The player button -->
<div class="overlay-play-button__play"> <div class="overlay-play-button__play">...</div>
...
</div>
</div> </div>
</div> </div>
``` ```
@@ -50,7 +48,7 @@ keywords: css flexbox
} }
.overlay-play-button__play { .overlay-play-button__play {
border: 0.25rem solid #FFF; border: 0.25rem solid #fff;
border-radius: 9999px; border-radius: 9999px;
height: 3rem; height: 3rem;
width: 3rem; width: 3rem;

View File

@@ -10,9 +10,7 @@ keywords: css flexbox, css pagination
```html ```html
<div class="pagination"> <div class="pagination">
<!-- Pagination item --> <!-- Pagination item -->
<div class="pagination__item"> <div class="pagination__item">...</div>
...
</div>
<!-- Repeat other items --> <!-- Repeat other items -->
... ...

View File

@@ -8,9 +8,7 @@ keywords: css price tag
## HTML ## HTML
```html ```html
<div class="price-tag"> <div class="price-tag">...</div>
...
</div>
``` ```
## CSS ## CSS
@@ -46,8 +44,7 @@ keywords: css price tag
border-color: transparent var(--price-tag-background) transparent transparent; border-color: transparent var(--price-tag-background) transparent transparent;
border-style: solid; border-style: solid;
border-width: calc(var(--price-tag-height) / 2) calc(var(--price-tag-height) / 2) border-width: calc(var(--price-tag-height) / 2) calc(var(--price-tag-height) / 2) calc(var(--price-tag-height) / 2) 0rem;
calc(var(--price-tag-height) / 2) 0rem;
/* Position */ /* Position */
left: 0px; left: 0px;

View File

@@ -44,6 +44,8 @@ keywords: css flexbox, css progress bar
} }
``` ```
{% demo %} {% demo %}{% include "covers/progress-bar.njk" %}{% enddemo %}
{% include "covers/progress-bar.njk" %}
{% enddemo %} ## See also
- [Indeterminate progress bar](/indeterminate-progress-bar/)

View File

@@ -13,25 +13,18 @@ keywords: css accordion, css faq, css flexbox
<!-- Heading --> <!-- Heading -->
<div class="questions-and-answers__header"> <div class="questions-and-answers__header">
<!-- Question --> <!-- Question -->
<div class="questions-and-answers__title"> <div class="questions-and-answers__title">...</div>
...
</div>
<!-- The toggle icon sticks to the right --> <!-- The toggle icon sticks to the right -->
<div class="questions-and-answers__toggle"> <div class="questions-and-answers__toggle"></div>
</div>
</div> </div>
<!-- Answer --> <!-- Answer -->
<div class="questions-and-answers__content"> <div class="questions-and-answers__content">...</div>
...
</div>
</div> </div>
<!-- Expanded question and answer item --> <!-- Expanded question and answer item -->
<div class="questions-and-answers__item questions-and-answers__item--expanded"> <div class="questions-and-answers__item questions-and-answers__item--expanded">...</div>
...
</div>
``` ```
## CSS ## CSS

View File

@@ -10,9 +10,7 @@ keywords: css clip rect, css flexbox, css progress bar
```html ```html
<div class="radial-progress-bar"> <div class="radial-progress-bar">
<!-- Show number of percentages --> <!-- Show number of percentages -->
<div class="radial-progress-bar__percentages"> <div class="radial-progress-bar__percentages">...</div>
...
</div>
<!-- The curve --> <!-- The curve -->
<div class="radial-progress-bar__curve"> <div class="radial-progress-bar__curve">
@@ -29,7 +27,7 @@ keywords: css clip rect, css flexbox, css progress bar
```css ```css
:root { :root {
--radial-progress-bar-size: 8rem; --radial-progress-bar-size: 8rem;
--radial-progress-bar-border-width: 0.75rem; --radial-progress-bar-border-width: 0.75rem;
} }
@@ -93,25 +91,15 @@ keywords: css clip rect, css flexbox, css progress bar
.radial-progress-bar__half--first { .radial-progress-bar__half--first {
/* Position */ /* Position */
clip: rect( clip: rect(0px, calc(var(--radial-progress-bar-size) * 0.5), var(--radial-progress-bar-size), 0px);
0px,
calc(var(--radial-progress-bar-size) * 0.5),
var(--radial-progress-bar-size),
0px
);
/* Number of percentages * 360 / 100 */ /* Number of percentages * 360 / 100 */
transform: rotate(270deg); transform: rotate(270deg);
} }
.radial-progress-bar__half--second { .radial-progress-bar__half--second {
/* Position */ /* Position */
clip: rect( clip: rect(0px, calc(var(--radial-progress-bar-size) * 0.5), var(--radial-progress-bar-size), 0px);
0px,
calc(var(--radial-progress-bar-size) * 0.5),
var(--radial-progress-bar-size),
0px
);
/* If percentages is less than 50 */ /* If percentages is less than 50 */
/* transform: rotate(0deg); */ /* transform: rotate(0deg); */

View File

@@ -19,9 +19,7 @@ keywords: css flexbox, css radio button
</label> </label>
<!-- Selected item --> <!-- Selected item -->
<label class="radio-button-group__label radio-button-group__label--selected"> <label class="radio-button-group__label radio-button-group__label--selected"> ... </label>
...
</label>
<!-- Repeat other items --> <!-- Repeat other items -->
... ...

View File

@@ -15,9 +15,7 @@ keywords: css flexbox, css layout, css same height columns
... ...
<!-- Content --> <!-- Content -->
<div class="same-height-columns__content"> <div class="same-height-columns__content">...</div>
...
</div>
<!-- Button sticks to the bottom --> <!-- Button sticks to the bottom -->
... ...

View File

@@ -10,9 +10,7 @@ keywords: css divider, css flexbox, css separator
```html ```html
<div class="separator"> <div class="separator">
<!-- Text --> <!-- Text -->
<div class="separator__content"> <div class="separator__content">...</div>
...
</div>
<!-- Separator line --> <!-- Separator line -->
<div class="separator__separator"></div> <div class="separator__separator"></div>

View File

@@ -10,14 +10,10 @@ keywords: css flexbox, css layout, css sidebar
```html ```html
<div class="sidebar"> <div class="sidebar">
<!-- Sidebar --> <!-- Sidebar -->
<aside class="sidebar__sidebar"> <aside class="sidebar__sidebar">...</aside>
...
</aside>
<!-- Main --> <!-- Main -->
<main class="sidebar__main"> <main class="sidebar__main">...</main>
...
</main>
</div> </div>
``` ```

View File

@@ -14,9 +14,7 @@ keywords: css flexbox, css flexbox grid, css grid, css layout
<div class="simple-grid__cell simple-grid__cell--1/4">25%</div> <div class="simple-grid__cell simple-grid__cell--1/4">25%</div>
<!-- Cell that takes remaining width --> <!-- Cell that takes remaining width -->
<div class="simple-grid__cell simple-grid__cell--fill"> <div class="simple-grid__cell simple-grid__cell--fill">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -15,14 +15,10 @@ keywords: css flexbox, css spin button
<!-- Buttons spin-button --> <!-- Buttons spin-button -->
<div class="spin-button__buttons"> <div class="spin-button__buttons">
<!-- Up button --> <!-- Up button -->
<button class="spin-button__button"> <button class="spin-button__button">...</button>
...
</button>
<!-- Down button --> <!-- Down button -->
<button class="spin-button__button"> <button class="spin-button__button">...</button>
...
</button>
</div> </div>
</div> </div>
``` ```

View File

@@ -10,14 +10,10 @@ keywords: css flexbox, css layout, css split screen
```html ```html
<div class="split-screen"> <div class="split-screen">
<!-- Left content --> <!-- Left content -->
<div class="split-screen__half"> <div class="split-screen__half">...</div>
...
</div>
<!-- Right content --> <!-- Right content -->
<div class="split-screen__half"> <div class="split-screen__half">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -10,14 +10,10 @@ keywords: css flexbox, css statistic
```html ```html
<div class="statistic"> <div class="statistic">
<!-- Value --> <!-- Value -->
<div class="statistic__value"> <div class="statistic__value">...</div>
...
</div>
<!-- Label --> <!-- Label -->
<div class="statistic__label"> <div class="statistic__label">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -13,9 +13,7 @@ keywords: css flexbox, css status light
<div class="status-light__status"></div> <div class="status-light__status"></div>
<!-- Content --> <!-- Content -->
<div class="status-light__content"> <div class="status-light__content">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -9,15 +9,9 @@ keywords: css flexbox, css layout, css sticky, css sticky footer
```html ```html
<div class="sticky-footer"> <div class="sticky-footer">
<header class="sticky-footer__header"> <header class="sticky-footer__header">...</header>
... <main class="sticky-footer__main">...</main>
</header> <footer class="sticky-footer__footer">...</footer>
<main class="sticky-footer__main">
...
</main>
<footer class="sticky-footer__footer">
...
</footer>
</div> </div>
``` ```

View File

@@ -9,12 +9,8 @@ keywords: css layout, css position sticky, css sticky header
```html ```html
<div> <div>
<header class="sticky-header__header"> <header class="sticky-header__header">...</header>
... <main>...</main>
</header>
<main>
...
</main>
</div> </div>
``` ```

View File

@@ -9,9 +9,7 @@ keywords: css layout, css sticky, css sticky sections
```html ```html
<div class="sticky-sections"> <div class="sticky-sections">
<section class="sticky-sections__section"> <section class="sticky-sections__section">...</section>
...
</section>
<!-- Repeat other sections --> <!-- Repeat other sections -->
... ...

View File

@@ -11,9 +11,7 @@ keywords: css position sticky, css sticky table column
<table class="sticky-table-column"> <table class="sticky-table-column">
<thead> <thead>
<tr> <tr>
<th class="sticky-table-column__sticky"> <th class="sticky-table-column__sticky">...</th>
...
</th>
<!-- Other header column ... --> <!-- Other header column ... -->
</tr> </tr>

View File

@@ -10,14 +10,10 @@ keywords: css flexbox, css navigation, css tab
```html ```html
<div class="tab"> <div class="tab">
<!-- Active tab --> <!-- Active tab -->
<div class="tab__item tab__item--active"> <div class="tab__item tab__item--active">...</div>
...
</div>
<!-- Inactive tab --> <!-- Inactive tab -->
<div class="tab__item tab__item--inactive"> <div class="tab__item tab__item--inactive">...</div>
...
</div>
</div> </div>
``` ```
@@ -52,7 +48,6 @@ keywords: css flexbox, css navigation, css tab
/* Has only the bottom border */ /* Has only the bottom border */
border-bottom: 1px solid #d1d5db; border-bottom: 1px solid #d1d5db;
} }
``` ```
{% demo %}{% include "covers/tab.njk" %}{% enddemo %} {% demo %}{% include "covers/tab.njk" %}{% enddemo %}

View File

@@ -10,9 +10,7 @@ keywords: css border radius, css teardrop, css water drop shape, css water dropl
```html ```html
<div class="teardrop"> <div class="teardrop">
<!-- Display the content vertically --> <!-- Display the content vertically -->
<div class="teardrop__content"> <div class="teardrop__content">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -8,9 +8,7 @@ keywords: css 3D card
## HTML ## HTML
```html ```html
<div class="three-dimensions-card"> <div class="three-dimensions-card">...</div>
...
</div>
``` ```
## CSS ## CSS
@@ -20,7 +18,7 @@ keywords: css 3D card
--three-dimensions-card-left-side-width: 1rem; --three-dimensions-card-left-side-width: 1rem;
} }
.three-dimensions-card { .three-dimensions-card {
position: relative; position: relative;
} }

View File

@@ -22,15 +22,11 @@ keywords: css flexbox, css timeline
<div class="timeline__circle"></div> <div class="timeline__circle"></div>
<!-- The title --> <!-- The title -->
<div class="timeline__title"> <div class="timeline__title">...</div>
...
</div>
</div> </div>
<!-- The description --> <!-- The description -->
<div class="timeline__desc"> <div class="timeline__desc">...</div>
...
</div>
</div> </div>
<!-- Repeat other items --> <!-- Repeat other items -->

View File

@@ -13,9 +13,7 @@ keywords: css flexbox, toggle password visibilit
<input type="text" class="toggle-password-visibility__input" /> <input type="text" class="toggle-password-visibility__input" />
<!-- Toggle button sticks to the right --> <!-- Toggle button sticks to the right -->
<button class="toggle-password-visibility__toggle"> <button class="toggle-password-visibility__toggle">...</button>
...
</button>
</div> </div>
``` ```
@@ -53,13 +51,11 @@ keywords: css flexbox, toggle password visibilit
In reality, the `click` event handler of the button needs to update the `type` attribute of the input to `text` or `password`: In reality, the `click` event handler of the button needs to update the `type` attribute of the input to `text` or `password`:
```js ```js
document document.querySelector('.toggle-password-visibility__toggle').addEventListener('click', (e) => {
.querySelector('.toggle-password-visibility__toggle') const input = e.target.previousElementSibling;
.addEventListener('click', (e) => { const type = input.getAttribute('type');
const input = e.target.previousElementSibling; input.setAttribute('type', type === 'text' ? 'password' : 'text');
const type = input.getAttribute('type'); });
input.setAttribute('type', type === 'text' ? 'password' : 'text');
});
``` ```
{% demo %}{% include "covers/toggle-password-visibility.njk" %}{% enddemo %} {% demo %}{% include "covers/toggle-password-visibility.njk" %}{% enddemo %}

View File

@@ -10,9 +10,7 @@ keywords: css tooltip
```html ```html
<div class="tooltip"> <div class="tooltip">
<!-- The tooltip content --> <!-- The tooltip content -->
<div class="tooltip__content"> <div class="tooltip__content">...</div>
...
</div>
<!-- The tooltip arrow --> <!-- The tooltip arrow -->
<div class="tooltip__arrow"></div> <div class="tooltip__arrow"></div>

View File

@@ -31,7 +31,7 @@ keywords: css sitemap, css tree diagram
... ...
</ul> </ul>
</li> </li>
<!-- Repeat other items --> <!-- Repeat other items -->
... ...
</ul> </ul>
@@ -120,9 +120,7 @@ You can add a root item to the tree:
```html ```html
<div class="tree-diagram"> <div class="tree-diagram">
<ul> <ul>
<li class="tree-diagram__root"> <li class="tree-diagram__root">...</li>
...
</li>
</ul> </ul>
</div> </div>
``` ```

View File

@@ -13,15 +13,11 @@ In this pattern, the video is displayed in the background.
<div class="video-background"> <div class="video-background">
<!-- The video container --> <!-- The video container -->
<div class="video-background__inner"> <div class="video-background__inner">
<video class="video-background__video" src="..."> <video class="video-background__video" src="...">...</video>
...
</video>
</div> </div>
<!-- The content --> <!-- The content -->
<div class="video-background__content"> <div class="video-background__content">...</div>
...
</div>
</div> </div>
``` ```

View File

@@ -12,9 +12,7 @@ keywords: css watermark
<!-- Watermark container --> <!-- Watermark container -->
<div class="watermark__inner"> <div class="watermark__inner">
<!-- The watermark --> <!-- The watermark -->
<div class="watermark__body"> <div class="watermark__body">Draft</div>
Draft
</div>
</div> </div>
<!-- Other content --> <!-- Other content -->

View File

@@ -16,9 +16,7 @@ keywords: css flexbox, css stepper, css wizard
<div class="wizard__connector"></div> <div class="wizard__connector"></div>
<!-- The step number --> <!-- The step number -->
<div class="wizard__number"> <div class="wizard__number">...</div>
...
</div>
<!-- The right connector --> <!-- The right connector -->
<div class="wizard__connector"></div> <div class="wizard__connector"></div>

View File

@@ -10,7 +10,7 @@
grid-template-columns: repeat(var(--category__post-num-columns), 1fr); grid-template-columns: repeat(var(--category__post-num-columns), 1fr);
background-color: #fff; background-color: #fff;
border-radius: 0.5rem; border-radius: 0.5rem;
box-shadow: 0 0 1.5rem rgb(0 0 0 / 10%); box-shadow: 0 0 1.5rem rgb(0 0 0 / 10%);
} }
.category__link { .category__link {
background: #4338ca; background: #4338ca;
@@ -38,4 +38,4 @@
:root { :root {
--category__post-num-columns: 5; --category__post-num-columns: 5;
} }
} }

View File

@@ -80,4 +80,4 @@
right: -5%; right: -5%;
transform: scale(1.1) rotate(-7deg); transform: scale(1.1) rotate(-7deg);
} }
} }

View File

@@ -68,4 +68,4 @@
} }
.example__content--large { .example__content--large {
height: 40rem; height: 40rem;
} }

View File

@@ -27,4 +27,4 @@
color: #6366f1; color: #6366f1;
font-size: 1.25rem; font-size: 1.25rem;
font-weight: 500; font-weight: 500;
} }

View File

@@ -55,6 +55,7 @@
@import './patterns/full-background'; @import './patterns/full-background';
@import './patterns/full-screen-menu'; @import './patterns/full-screen-menu';
@import './patterns/holy-grail'; @import './patterns/holy-grail';
@import './patterns/indeterminate-progress-bar';
@import './patterns/initial-avatar'; @import './patterns/initial-avatar';
@import './patterns/input-addon'; @import './patterns/input-addon';
@import './patterns/inverted-corners'; @import './patterns/inverted-corners';

View File

@@ -2,4 +2,4 @@
font-size: 1.5rem; font-size: 1.5rem;
margin-top: 2rem; margin-top: 2rem;
text-align: center; text-align: center;
} }

View File

@@ -29,4 +29,4 @@
} }
.accordion__item--expanded .accordion__content { .accordion__item--expanded .accordion__content {
display: block; display: block;
} }

View File

@@ -63,4 +63,4 @@
left: 0; left: 0;
top: 50%; top: 50%;
transform: translate(0%, -50%); transform: translate(0%, -50%);
} }

View File

@@ -10,8 +10,8 @@
} }
.avatars__image { .avatars__image {
background-color: #d1d5db; background-color: #d1d5db;
box-shadow: 0 0 0 0.25rem #FFF; box-shadow: 0 0 0 0.25rem #fff;
color: #FFF; color: #fff;
font-size: 0.75rem; font-size: 0.75rem;
/* Rounded border */ /* Rounded border */
@@ -25,4 +25,4 @@
/* Size */ /* Size */
height: 2rem; height: 2rem;
width: 2rem; width: 2rem;
} }

View File

@@ -14,4 +14,4 @@
.avatar__image { .avatar__image {
height: 50%; height: 50%;
width: 50%; width: 50%;
} }

View File

@@ -12,4 +12,4 @@
border-radius: 9999px; border-radius: 9999px;
height: 3rem; height: 3rem;
width: 3rem; width: 3rem;
} }

View File

@@ -4,7 +4,7 @@
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
column-gap: 0.5rem; column-gap: 0.5rem;
row-gap: 0.5rem; row-gap: 0.5rem;
height: 8rem; height: 8rem;
width: 8rem; width: 8rem;
} }
@@ -12,7 +12,7 @@
.box-selector { .box-selector {
border: 1px solid #d1d5db; border: 1px solid #d1d5db;
border-radius: 0.25rem; border-radius: 0.25rem;
padding: .5rem; padding: 0.5rem;
} }
.box-selector--selected { .box-selector--selected {
@@ -32,4 +32,4 @@
background-position: center center; background-position: center center;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
} }

View File

@@ -10,11 +10,11 @@
} }
.breadcrumb__item:not(:last-child)::after { .breadcrumb__item:not(:last-child)::after {
/* Absolute position */ /* Absolute position */
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
transform: translate(0.5rem, 0px); transform: translate(0.5rem, 0px);
content: '/'; content: '/';
} }

View File

@@ -8,11 +8,11 @@
/* Demo */ /* Demo */
background: #fff; background: #fff;
border: 1px solid #d1d5db; border: 1px solid #d1d5db;
border-radius: 0.25rem; border-radius: 0.25rem;
width: 8rem; width: 8rem;
} }
.button-with-icon__label { .button-with-icon__label {
flex: 1; flex: 1;
margin-left: 0.5rem; margin-left: 0.5rem;
} }

View File

@@ -24,10 +24,10 @@
color: #fff; color: #fff;
} }
.calendar__day:nth-child(7n+1) { .calendar__day:nth-child(7n + 1) {
border-left: 1px solid #d1d5db; border-left: 1px solid #d1d5db;
} }
.calendar__day--disabled { .calendar__day--disabled {
color: #e5e7eb; color: #e5e7eb;
} }

View File

@@ -20,4 +20,4 @@
/* Demo */ /* Demo */
margin: 0.25rem 0; margin: 0.25rem 0;
} }

View File

@@ -16,4 +16,4 @@
/* Take available height */ /* Take available height */
flex: 1; flex: 1;
padding: 0.5rem; padding: 0.5rem;
} }

View File

@@ -6,4 +6,4 @@
/* Demo */ /* Demo */
flex-direction: column; flex-direction: column;
width: 6rem; width: 6rem;
} }

View File

@@ -63,7 +63,7 @@
--circular-navigation__circle-degree: 60deg; --circular-navigation__circle-degree: 60deg;
--circular-navigation__content-degree: -60deg; --circular-navigation__content-degree: -60deg;
} }
.circular-navigation__circle--3{ .circular-navigation__circle--3 {
--circular-navigation__circle-degree: 120deg; --circular-navigation__circle-degree: 120deg;
--circular-navigation__content-degree: -120deg; --circular-navigation__content-degree: -120deg;
} }

View File

@@ -15,20 +15,20 @@
margin: 0.5rem; margin: 0.5rem;
} }
.swatch__item--1st { .swatch__item--1st {
background-color: rgba(0, 0, 0, .1); background-color: rgba(0, 0, 0, 0.1);
} }
.swatch__item--2nd { .swatch__item--2nd {
background-color: rgba(0, 0, 0, .2); background-color: rgba(0, 0, 0, 0.2);
} }
.swatch__item--3rd { .swatch__item--3rd {
background-color: #d1d5db; background-color: #d1d5db;
} }
.swatch__item--4th { .swatch__item--4th {
background-color: rgba(0, 0, 0, .4); background-color: rgba(0, 0, 0, 0.4);
} }
.swatch__item--5th { .swatch__item--5th {
background-color: rgba(0, 0, 0, .5); background-color: rgba(0, 0, 0, 0.5);
} }
.swatch__item--6th { .swatch__item--6th {
background-color: rgba(0, 0, 0, .6); background-color: rgba(0, 0, 0, 0.6);
} }

View File

@@ -53,4 +53,4 @@
/* Border radius */ /* Border radius */
border-radius: 1rem 0 0 0; border-radius: 1rem 0 0 0;
} }

View File

@@ -9,9 +9,9 @@
display: flex; display: flex;
} }
.cookie-banner__content { .cookie-banner__content {
border-top: 1px solid #d1d5db; border-top: 1px solid #d1d5db;
/* Take available width */ /* Take available width */
flex: 1; flex: 1;
padding: 0 0.5rem; padding: 0 0.5rem;
} }

View File

@@ -38,4 +38,4 @@
/* Centerize the text content */ /* Centerize the text content */
text-align: center; text-align: center;
} }

View File

@@ -11,4 +11,4 @@
height: 50%; height: 50%;
width: 100%; width: 100%;
} }

View File

@@ -35,4 +35,4 @@
.custom-checkbox-button__checkbox--selected { .custom-checkbox-button__checkbox--selected {
/* For selected checkbox */ /* For selected checkbox */
background-color: #3b82f6; background-color: #3b82f6;
} }

View File

@@ -39,4 +39,4 @@
.custom-radio-button__radio--selected { .custom-radio-button__radio--selected {
/* For selected radio */ /* For selected radio */
background-color: #3b82f6; background-color: #3b82f6;
} }

View File

@@ -21,4 +21,4 @@
/* Background color */ /* Background color */
background-color: #d1d5db; background-color: #d1d5db;
} }

View File

@@ -22,4 +22,4 @@
/* Size */ /* Size */
height: 1rem; height: 1rem;
width: 1rem; width: 1rem;
} }

Some files were not shown because too many files have changed in this diff Show More