A Complete Guide To Grid - CSS-Tricks
Có thể bạn quan tâm
grid-template-columnsgrid-template-rows
Defines the columns and rows of the grid with a space-separated list of values. The values represent the track size, and the space between them represents the grid line.
Values:
- <track-size> – can be a length, a percentage, or a fraction of the free space in the grid using the fr unit (more on this unit over at DigitalOcean)
- <line-name> – an arbitrary name of your choosing
Grid lines are automatically assigned positive numbers from these assignments (-1 being an alternate for the very last row).
But you can choose to explicitly name the lines. Note the bracket syntax for the line names:
.container { grid-template-columns: [first] 40px [line2] 50px [line3] auto [col4-start] 50px [five] 40px [end]; grid-template-rows: [row1-start] 25% [row1-end] 100px [third-line] auto [last-line]; }Note that a line can have more than one name. For example, here the second line will have two names: row1-end and row2-start:
.container { grid-template-rows: [row1-start] 25% [row1-end row2-start] 25% [row2-end]; }If your definition contains repeating parts, you can use the repeat() notation to streamline things:
.container { grid-template-columns: repeat(3, 20px [col-start]); }Which is equivalent to this:
.container { grid-template-columns: 20px [col-start] 20px [col-start] 20px [col-start]; }If multiple lines share the same name, they can be referenced by their line name and count.
.item { grid-column-start: col-start 2; }The fr unit allows you to set the size of a track as a fraction of the free space of the grid container. For example, this will set each item to one third the width of the grid container:
.container { grid-template-columns: 1fr 1fr 1fr; }The free space is calculated after any non-flexible items. In this example the total amount of free space available to the fr units doesn’t include the 50px:
.container { grid-template-columns: 1fr 50px 1fr 1fr; }Từ khóa » Html Ul Li Grid
-
How To Lay-out List Items Like A Grid With CSS And HTML?
-
The CSS Grid Methods - Elad Shechter - Medium
-
Auto-placement In CSS Grid Layout - MDN Web Docs
-
How To Create A List Grid View - W3Schools
-
List Items In Grid Columns - HTML & CSS - SitePoint Forums
-
4 CSS Grid Properties (and One Value) For Most Of Your Layout Needs
-
Grid - List HTML - CSS - JQuery - Gists · GitHub
-
List Group - Bootstrap
-
Usage Examples Of CSS Grid Layout - Grid By Example
-
Thumbnail Grid Layout Instructions
-
How To Display Unordered List In Two Columns - W3docs
-
Using Position Sticky With CSS Grid - Ahmad Shadeed
-
Responsive Boxes
- Grid - CodePen
-
HTML And CSS Tutorial - Nanyang Technological University