align-tracks - CSS: Cascading Style Sheets 编辑

Experimental

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The align-tracks CSS property sets the alignment in the masonry axis for grid containers that have masonry in their block axis.

Syntax

/* Keyword values */
align-tracks: start;
align-tracks: space-between;
align-tracks: center;
align-tracks: start,center,end;

/* Global values */
align-tracks: inherit;
align-tracks: initial;
align-tracks: unset;

The property can take a single value, in which case all tracks are aligned in the same way. If a list of values is used then the first value applies to the first track in the grid axis, the second to the next and so on.

If there are fewer values than tracks, the last value is used for all remaining tracks. If there are more values than tracks, any additional values are ignored.

Values

start
The items are packed flush to each other toward the start edge of the alignment container in the masonry axis.
end
The items are packed flush to each other toward the end edge of the alignment container in the masonry axis.
center
The items are packed flush to each other toward the center of the alignment container along the masonry axis.
normal
Acts as start.
baseline
first baseline

last baseline
Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box’s first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group.
The fallback alignment for first baseline is start, the one for last baseline is end.
space-between
The items are evenly distributed within the alignment container along the masonry axis. The spacing between each pair of adjacent items is the same. The first item is flush with the main-start edge, and the last item is flush with the main-end edge.
space-around
The items are evenly distributed within the alignment container along the masonry axis. The spacing between each pair of adjacent items is the same. The empty space before the first and after the last item equals half of the space between each pair of adjacent items.
space-evenly
The items are evenly distributed within the alignment container along the masonry axis. The spacing between each pair of adjacent items, the main-start edge and the first item, and the main-end edge and the last item, are all exactly the same.
stretch

The items stretch along the masonry axis to fill the content box. Items with definite size do not stretch.

Formal definition

Initial valuenormal
Applies toGrid containers with masonry layout in their block axis
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

[ normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position> ]#

where
<baseline-position> = [ first | last ]? baseline
<content-distribution> = space-between | space-around | space-evenly | stretch
<overflow-position> = unsafe | safe
<content-position> = center | start | end | flex-start | flex-end

Examples

Masonry layout with multiple values for align-tracks

Specifications

SpecificationStatusComment
CSS Grid Layout Module Level 3
The definition of 'align-tracks' in that specification.
Editor's DraftInitial definition

Browser compatibility

BCD tables only load in the browser

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:76 次

字数:9430

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文