mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-30 21:54:36 -04:00
Improve flex list item padding (#26779)
Replace #26761
It's better to keep children elements simple, and let parent containers
layout the necessary padding/margin.
The old `not(:last-child)` and `.flex-item + .flex-item` are not easy to
maintain (for example, what if the developer would like to use a "tiny
height" item?)
The old approach also makes some UI look strange because the first item
doesn't have proper padding-top.
In this PR, we just simply use `.flex-item { padding: ... }`:
* Developers could manually set the item height they want easily
* It's easier to make it work with various containers -- with padding
(`ui segment`) and without padding (`div`)
And added more samples/examples.

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
4f5a2117c3
commit
1a9998ce91
2 changed files with 30 additions and 8 deletions
|
@ -6,10 +6,7 @@
|
|||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.flex-item:not(:last-child) {
|
||||
padding-bottom: 8px;
|
||||
padding: 1em 0;
|
||||
}
|
||||
|
||||
.flex-item-baseline {
|
||||
|
@ -92,5 +89,13 @@
|
|||
|
||||
.flex-list > .flex-item + .flex-item {
|
||||
border-top: 1px solid var(--color-secondary);
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
/* Fomantic UI segment has default "padding: 1em", so here it removes the padding-top and padding-bottom accordingly */
|
||||
.ui.segment > .flex-list:first-child > .flex-item:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.ui.segment > .flex-list:last-child > .flex-item:last-child {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue