Related Topics
Introduction
Html page 1
Html page 2
Html page3
Html page4
HTML Elements and structure
Html page 5
Html page 6
Html page 7
HTML Headings and Paragraphs
Html page 8
Html page 9
Html page 10
HTML Lists and Tables
Html page 11
Html page 12
Html page 13
HTML Forms and Input Fields
Html page 14
Html page 15
Html page 16
HTML Images and Media
Html page 17
Html page 18
HTML Links and Anchors
Html page 19
Html page 20
Html page 21
HTML Styles and Formatting
Html page 22
HTML Semantic Elements
Html page 23
Html page 24
HTML Attributes
Html page 25
Html page 26
HTML JavaScript Integration
Html page 27
Html page 28
Html page 29
Html page 30
HTML Document and Browser Support
Html page 31
Html page 32
HTML5 New Elements and Attributes
Html page 33
Html page 34
Html page 35
Html page 36
HTML Accessibility and Web Standards
Html page 37
Html page 38
Html page 39
HTML Responsive Design and Mobile Devices.
Html page 40
Html page 41
Html page 42
Introduction
Data Structure Page 1
Data Structure Page 2
Data Structure Page 3
Data Structure Page 4
Data Structure Page 5
Data Structure Page 6
Data Structure Page 7
Data Structure Page 8
String
Data Structure Page 9
Data Structure Page 10
Data Structure Page 11
Data Structure Page 12
Data Structure Page 13
Array
Data Structure Page 14
Data Structure Page 15
Data Structure Page 16
Data Structure Page 17
Data Structure Page 18
Linked List
Data Structure Page 19
Data Structure Page 20
Stack
Data Structure Page 21
Data Structure Page 22
Queue
Data Structure Page 23
Data Structure Page 24
Tree
Data Structure Page 25
Data Structure Page 26
Binary Tree
Data Structure Page 27
Data Structure Page 28
Heap
Data Structure Page 29
Data Structure Page 30
Graph
Data Structure Page 31
Data Structure Page 32
Searching Sorting
Data Structure Page 33
Hashing Collision
Data Structure Page 35
Data Structure Page 36

CSS
grid-template-rows: 100px 1fr auto;
grid-template-columns
: The syntax forgrid-template-columns
is similar togrid-template-rows
. It allows you to specify the size of each column individually or use shorthand notation to define multiple columns at once. For example:
grid-template-columns: 1fr 2fr 1fr;
Both grid-template-rows
and grid-template-columns
are fundamental properties in CSS Grid Layout, enabling you to establish the structure and sizing of rows and columns within a grid container. By utilizing these properties, you can create sophisticated and flexible grid-based layouts.
<div class="container">
<div class="item">Item 1</div>
<div class="item">Item 2</div>
<div class="item">Item 3</div>
</div>
CSS:
.container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
align-items: center; /* Vertical alignment: Center */
justify-items: center; /* Horizontal alignment: Center */
height: 300px;
}
.item {
border: 1px solid black;
}
In the above example, the .container
represents the grid container, and the .item
represents the grid items.
By setting align-items: center
and justify-items: center
on the container, the grid items will be both vertically and horizontally centered within their respective grid cells.
Feel free to adjust the alignment properties (align-items
and justify-items
) and experiment with different values to achieve your desired alignment within the grid container.
grid-area: / / / ;
Here’s a breakdown of the values:
<grid-row-start>
: The starting row line of the grid area.<grid-column-start>
: The starting column line of the grid area.<grid-row-end>
: The ending row line of the grid area.<grid-column-end>
: The ending column line of the grid area.
The values for grid-row-start
, grid-column-start
, grid-row-end
, and grid-column-end
can be either a line number, a named grid area, or one of the keywords: span
, auto
, or unset
.
Here’s an example to illustrate the use of grid-area
:
HTML:
<div class="container">
<div class="item item-1">1</div>
<div class="item item-2">2</div>
<div class="item item-3">3</div>
<div class="item item-4">4</div>
</div>
CSS:
.container {
display: grid;
grid-template-rows: 100px 100px;
grid-template-columns: 1fr 1fr;
grid-gap: 10px;
}
.item {
border: 1px solid black;
padding: 10px;
}
.item-1 {
grid-area: 1 / 1 / 2 / 3; /* Starts at row 1, column 1 and spans 1 row and 2 columns */
}
.item-2 {
grid-area: 2 / 1 / 3 / 2; /* Starts at row 2, column 1 and spans 1 row and 1 column */
}
.item-3 {
grid-area: 2 / 2; /* Starts at row 2, column 2 and spans the default 1 row and 1 column */
}
.item-4 {
grid-area: 1 / 2; /* Starts at row 1, column 2 and spans the default 1 row and 1 column */
}
In this example, the .container
represents the grid container, and .item
represents the grid items.
By using the grid-area
property on each item, we can specify the starting and ending positions of each item in terms of rows and columns. This allows us to control their placement and spanning within the grid.
For example, .item-1
uses grid-area: 1 / 1 / 2 / 3
, which means it starts at row 1, column 1, and spans 1 row and 2 columns. Similarly, the other items are positioned and spanned using grid-area
.
The use of grid-area
simplifies the code compared to setting individual grid-row
and grid-column
properties for each item.
With grid-area
, you can easily define the grid areas for your items, making it more concise and manageable, especially for complex grid layouts.




Popular Category
Topics for You
Introduction
Html page 1
Html page 2
Html page3
Html page4
HTML Elements and structure
Html page 5
Html page 6
Html page 7
HTML Headings and Paragraphs
Html page 8
Html page 9
Html page 10
HTML Lists and Tables
Html page 11
Html page 12
Html page 13
HTML Forms and Input Fields
Html page 14
Html page 15
Html page 16
HTML Images and Media
Html page 17
Html page 18
HTML Links and Anchors
Html page 19
Html page 20
Html page 21
HTML Styles and Formatting
Html page 22
HTML Semantic Elements
Html page 23
Html page 24
HTML Attributes
Html page 25
Html page 26
HTML JavaScript Integration
Html page 27
Html page 28
Html page 29
Html page 30
HTML Document and Browser Support
Html page 31
Html page 32
HTML5 New Elements and Attributes
Html page 33
Html page 34
Html page 35
Html page 36
HTML Accessibility and Web Standards
Html page 37
Html page 38
Html page 39
HTML Responsive Design and Mobile Devices.
Html page 40
Html page 41
Html page 42
Introduction
Data Structure Page 1
Data Structure Page 2
Data Structure Page 3
Data Structure Page 4
Data Structure Page 5
Data Structure Page 6
Data Structure Page 7
Data Structure Page 8
String
Data Structure Page 9
Data Structure Page 10
Data Structure Page 11
Data Structure Page 12
Data Structure Page 13
Array
Data Structure Page 14
Data Structure Page 15
Data Structure Page 16
Data Structure Page 17
Data Structure Page 18
Linked List
Data Structure Page 19
Data Structure Page 20
Stack
Data Structure Page 21
Data Structure Page 22
Queue
Data Structure Page 23
Data Structure Page 24
Tree
Data Structure Page 25
Data Structure Page 26
Binary Tree
Data Structure Page 27
Data Structure Page 28
Heap
Data Structure Page 29
Data Structure Page 30
Graph
Data Structure Page 31
Data Structure Page 32
Searching Sorting
Data Structure Page 33
Hashing Collision
Data Structure Page 35
Data Structure Page 36
Go through our study material. Your Job is awaiting.