CSS Grid Item
1
2
3
4
5
Try it Yourself »
Child Elements (Items)
A grid container contains grid items.
By default, a container has one grid item for each column, in each row, but you can style the grid items so that they
will span multiple columns and/or rows.
The grid-column Property:
The grid-column property defines on which
column(s) to place an item.
You define where the item will start, and where the item will end.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Note: The grid-column property is a shorthand property for
the grid-column-start and the grid-column-end properties.
To place an item, you can refer to line numbers, or use the keyword "span" to
define how many columns the item will span.
Example
Make "item1" start on column 1 and end before column 5:
.item1 {
grid-column: 1 / 5;}
Try it Yourself »
Example
Make "item1" start on column 1 and span 3 columns:
.item1 {
grid-column: 1 / span 3;}
Try it Yourself »
Example
Make "item2" start on column 2 and span 3 columns:
.item2 {
grid-column: 2 / span 3;}
Try it Yourself »
The grid-row Property:
The grid-row property defines on which row to
place an item.
You define where the item will start, and where the item will end.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Note: The grid-row property is a shorthand property for
the grid-row-start and the grid-row-end properties.
To place an item, you can refer to line numbers, or use the keyword "span" to
define how many rows the item will span:
Example
Make "item1" start on row-line 1 and end on row-line 4:
.item1 {
grid-row: 1 / 4;}
Try it Yourself »
Example
Make "item1" start on row 1 and span 2 rows:
.item1 {
grid-row: 1 / span 2;}
Try it Yourself »
The grid-area Property
The grid-area property can be used as a shorthand property for the
grid-row-start, grid-column-start, grid-row-end and the grid-column-end properties.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Example
Make "item8" start on row-line 1 and column-line 2, and end on row-line 5 and column line 6:
.item8 {
grid-area: 1 / 2 / 5 / 6;}
Try it Yourself »
Example
Make "item8" start on row-line 2 and column-line 1, and span 2 rows and 3 columns:
.item8 {
grid-area: 2 / 1 / span 2 / span 3;}
Try it Yourself »
Naming Grid Items
The grid-area property can also be used to assign names to grid items.
Header
Menu
Main
Right
Footer
Named grid items can be referred to by the grid-template-areas property
of the grid container.
Example
Item1 gets the name "myArea" and spans all five columns in a five columns grid layout:
.item1 { grid-area:
myArea;}.grid-container { grid-template-areas: 'myArea myArea
myArea myArea myArea';}
Try it Yourself »
Each row is defined by apostrophes (' ')
The columns in each row is defined inside the apostrophes, separated by a
space.
Note: A period sign represents a grid item with no name.
Example
Let "myArea" span two columns in a five columns grid layout (period signs
represent items with no name):
.item1 { grid-area:
myArea;}.grid-container { grid-template-areas: 'myArea myArea
. . .';}
Try it Yourself »
To define two rows, define the column of the second row inside another set of apostrophes:
Example
Make "item1" span two columns and two rows:
.grid-container { grid-template-areas: 'myArea myArea
. . .' 'myArea myArea . . .';}
Try it Yourself »
Example
Name all items, and make a ready-to-use webpage template:
.item1 { grid-area: header; }.item2 { grid-area: menu; }.item3 {
grid-area: main; }.item4 { grid-area: right; }.item5 { grid-area:
footer; }.grid-container { grid-template-areas:
'header header header header header header' 'menu main
main main right right' 'menu footer footer footer footer
footer';}
Try it Yourself »
The Order of the Items
The Grid Layout allows us to position the items anywhere we like.
The first item in the HTML code does not have to appear as the first item in the grid.
1
2
3
4
5
6
Example
.item1 { grid-area: 1 / 3 / 2 / 4; }.item2 { grid-area: 2 / 3 / 3 / 4; }
.item3 { grid-area: 1 / 1 / 2 / 2; }.item4 { grid-area: 1 / 2 / 2 / 3; }
.item5 { grid-area: 2 / 1 / 3 / 2; }.item6 { grid-area: 2 / 2 / 3 / 3; }
Try it Yourself »
You can re-arrange the order for certain screen sizes, by using media queries:
Example
@media only screen and (max-width: 500px) { .item1 { grid-area: 1 /
span 3 / 2 / 4; } .item2 { grid-area: 3 / 3 / 4 / 4; }
.item3 { grid-area: 2 / 1 / 3 / 2; } .item4 { grid-area: 2 / 2 /
span 2 / 3; } .item5 { grid-area: 3 / 1 / 4 / 2; } .item6
{ grid-area: 2 / 3 / 3 / 4; }}
Try it Yourself »
★
+1
Reference: https://www.w3schools.com/css/css_grid_item.asp
CSS Grid Item
-
- Posts: 0
- Joined: Wed Jun 25, 2025 2:31 am
Re: <t>CSS Grid Item</t>
Pandora Compatible Charm Beads For Charm Bracelets.
Charms Bead Diy Fit Original Pandora Charms Bracelet Necklace Women Jewelry ... 925 Sterling Silver Plated Beads Charm Fit Original DIY Bracelets For Women Gift , Design details: Our daisy charm features a delicate design adorned with sparkling cubic zirconia petals and meticulously applied enamel 。
Local Pickup available! Same-day shipping on all orders! Pandora Bracelets & Charm Holders. Filter. Close menu. Pandora. Bracelets & Charm Holders · Discover the best methods to clean your Pandora bracelet at home with our step-by-step guide. Keep your jewelry sparkling!.Celebrate your favourite moments with the Pandora charm bracelet, Pandora O Pendant and more jewellery accessories.Pandora brings the best in design and craftsmanship to its selection of jewelry - our charms, earrings , bracelets, necklaces , rings and much more.From elegant to contemporary, our bracelet styles include bangles, classic snake chains, leather, and more. Find one that matches your style.
Founded in 1982 by Per and Winnie Enevoldsen, Pandora A/S is a Danish jewelry manufacturer and retailer offering charm bracelets, rings, earrings, and necklaces. The company, which has two production sites in Thailand, imports materials including sterling silver, 14k gold, and gemstones. Pandora's products are marketed in over 100 countries with more than 6,700 points of sale. Axcel acquired a 60% stake in 2008, and shares were sold in an IPO in 2010.
Air Jordan 1
Cheap NFL Jerseys
NFL Jerseys
Air Jordan 4
Peter Milla
Yeezy 350
Pandora Charms
Yeezy Slides
Pandora Bracelets
Jordan 1S
Air Jordan 1
Arizona Cardinals Jerseys
Buffalo Bills Jerseys
Air Jordan 4
Peter Milla Golf Bottoms
Adidas Yeezy
Pandora Charms
Yeezy Slides
Pandora Bracelets
Jordan 1S
Charms Bead Diy Fit Original Pandora Charms Bracelet Necklace Women Jewelry ... 925 Sterling Silver Plated Beads Charm Fit Original DIY Bracelets For Women Gift , Design details: Our daisy charm features a delicate design adorned with sparkling cubic zirconia petals and meticulously applied enamel 。
Local Pickup available! Same-day shipping on all orders! Pandora Bracelets & Charm Holders. Filter. Close menu. Pandora. Bracelets & Charm Holders · Discover the best methods to clean your Pandora bracelet at home with our step-by-step guide. Keep your jewelry sparkling!.Celebrate your favourite moments with the Pandora charm bracelet, Pandora O Pendant and more jewellery accessories.Pandora brings the best in design and craftsmanship to its selection of jewelry - our charms, earrings , bracelets, necklaces , rings and much more.From elegant to contemporary, our bracelet styles include bangles, classic snake chains, leather, and more. Find one that matches your style.
Founded in 1982 by Per and Winnie Enevoldsen, Pandora A/S is a Danish jewelry manufacturer and retailer offering charm bracelets, rings, earrings, and necklaces. The company, which has two production sites in Thailand, imports materials including sterling silver, 14k gold, and gemstones. Pandora's products are marketed in over 100 countries with more than 6,700 points of sale. Axcel acquired a 60% stake in 2008, and shares were sold in an IPO in 2010.
Air Jordan 1
Cheap NFL Jerseys
NFL Jerseys
Air Jordan 4
Peter Milla
Yeezy 350
Pandora Charms
Yeezy Slides
Pandora Bracelets
Jordan 1S
Air Jordan 1
Arizona Cardinals Jerseys
Buffalo Bills Jerseys
Air Jordan 4
Peter Milla Golf Bottoms
Adidas Yeezy
Pandora Charms
Yeezy Slides
Pandora Bracelets
Jordan 1S