mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
Add the CSS gap shorthand and its row-gap/column-gap longhands for flex
containers.
- Register row-gap/column-gap as longhand properties and gap as a
shorthand accepting [ normal | <length-percentage> ]{1,2}.
- Add css_gap_t (CSS_GAP_INHERIT/SET/NORMAL) and corresponding
type/unit/value fields on css_computed_style_t.
- Implement cascade logic in lib/css/src/properties/gap.c, resolving
normal to zero and rejecting auto.
- Apply gaps in ui_flexbox_layout: main-axis gap participates in line
size, wrap detection, justify-content space and per-item positioning;
cross-axis gap participates in cross-size accumulation and line
positioning. The last item/line never gets a trailing gap. Percentage
gaps resolve against the container content-box on the corresponding
axis.
- Cover gap parsing/cascading in lib/css/tests (single/two values,
axis-only, normal, percentage) and add a flex layout integration test
exercising column-gap, row-gap, wrapped two-value gap and normal.
63 lines
766 B
CSS
63 lines
766 B
CSS
* {
|
|
font-size: 16px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.container {
|
|
max-width: 800px;
|
|
margin: 24px auto;
|
|
}
|
|
|
|
.button {
|
|
padding: 4px 8px;
|
|
min-width: 80px;
|
|
text-align: center;
|
|
border: 1px solid #eee;
|
|
border-radius: 4px;
|
|
background-color: #fff;
|
|
content: "submit";
|
|
}
|
|
|
|
.button:focus {
|
|
box-shadow: 0 0 0 2px rgba(0, 0, 200, 0.5);
|
|
}
|
|
|
|
.primary.button {
|
|
color: #fff;
|
|
background: #0050c9;
|
|
}
|
|
|
|
.button.borderless {
|
|
border: none;
|
|
}
|
|
|
|
.w-\[360px\] {
|
|
width: 360px;
|
|
}
|
|
|
|
.flex-gap {
|
|
display: flex;
|
|
gap: 12px;
|
|
}
|
|
|
|
.flex-gap-two-values {
|
|
display: flex;
|
|
gap: 8px 16px;
|
|
}
|
|
|
|
.flex-gap-axis {
|
|
display: flex;
|
|
row-gap: 4px;
|
|
column-gap: 20px;
|
|
}
|
|
|
|
.flex-gap-normal {
|
|
display: flex;
|
|
gap: normal;
|
|
}
|
|
|
|
.flex-gap-percentage {
|
|
display: flex;
|
|
gap: 25% 50%;
|
|
}
|