css grid layout
CSS
<!DOCTYPE html>
<html>
<head>
<style>
.grid-container {
display: grid;
grid-template-columns: auto auto auto;
background-color: #2196F3;
padding: 10px;
}
.grid-item {
background-color: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(0, 0, 0, 0.8);
padding: 20px;
font-size: 30px;
text-align: center;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
</div>
</body><!DOCTYPE html>
<html>
<head>
<style>
.grid-container {
display: grid;
grid-template-columns: auto auto auto;
background-color: #2196F3;
padding: 10px;
}
.grid-item {
background-color: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(0, 0, 0, 0.8);
padding: 20px;
font-size: 30px;
text-align: center;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
</div>
</body>.container {
display: grid | inline-grid;
}.item-a {
grid-area: header;
}
.item-b {
grid-area: main;
}
.item-c {
grid-area: sidebar;
}
.item-d {
grid-area: footer;
}
.container {
display: grid;
grid-template-columns: 50px 50px 50px 50px;
grid-template-rows: auto;
grid-template-areas:
"header header header header"
"main main . sidebar"
"footer footer footer footer";
}@supports (display: grid) {
main {
max-width: 10000px;
margin: 0;
}
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 2fr));
grid-gap: 1rem;
}
}/* Answer to: "css display grid" */
/*
The CSS Grid Layout Module offers a grid-based layout system,
with rows and columns, making it easier to design web pages
without having to use floats and positioning.
An HTML element becomes a grid container when its display property
is set to grid or inline-grid.
For more information, go to:
https://www.w3schools.com/css/css_grid.asp
*/
.grid-container {
display: grid;
}
/* or */
.grid-container {
display: inline-grid;
}
Also in CSS:
- Title
- best css framework 2020
- Category
- CSS
- Title
- css important
- Category
- CSS
- Title
- css textarea limit
- Category
- CSS
- Title
- add border to input css
- Category
- CSS
- Title
- margin css
- Category
- CSS
- Title
- css dropdown
- Category
- CSS
- Title
- javascript remove css class
- Category
- CSS
- Title
- gradient over image css
- Category
- CSS
- Title
- inline css
- Category
- CSS
- Title
- css change background color of page
- Category
- CSS
- Title
- pair impaire css
- Category
- CSS
- Title
- css border width
- Category
- CSS
- Title
- center ul
- Category
- CSS
- Title
- kotlin string to int
- Category
- CSS
- Title
- How do you change the font colour in CSS?
- Category
- CSS
- Title
- background-image: image css
- Category
- CSS
- Title
- angular headers for enc type
- Category
- CSS
- Title
- css no overflow
- Category
- CSS
- Title
- bootstrap 4 scss angular 8
- Category
- CSS
- Title
- how long since 1993
- Category
- CSS
- Title
- javascript add inline style css var
- Category
- CSS
- Title
- how rotate infinity css
- Category
- CSS
- Title
- font height css
- Category
- CSS
- Title
- repeat autofill css grid minmax
- Category
- CSS
- Title
- css ie11 only
- Category
- CSS
- Title
- css push div down
- Category
- CSS
- Title
- css focus border radius
- Category
- CSS
- Title
- css selenium
- Category
- CSS
- Title
- not last child css
- Category
- CSS
- Title
- how to change the page background in css
- Category
- CSS
- Title
- javascript canvas pixel art
- Category
- CSS
- Title
- static css is not fetching style in django
- Category
- CSS
- Title
- free css templates
- Category
- CSS
- Title
- css light grey
- Category
- CSS
- Title
- how to make image not repeat on background
- Category
- CSS
- Title
- css multiple classes
- Category
- CSS
- Title
- pixel to inches
- Category
- CSS
- Title
- fonts from google fonts do not work
- Category
- CSS
- Title
- css list style url siz
- Category
- CSS
- Title
- how to apply bg image in inline css
- Category
- CSS
- Title
- col-xs-12 col-sm-4 col-md-4 col-lg-4
- Category
- CSS
- Title
- vertical align span tailwindscss
- Category
- CSS
- Title
- css grid center elements inside div
- Category
- CSS
- Title
- all cursor types
- Category
- CSS
- Title
- adjecent sibling selectors
- Category
- CSS
- Title
- how to use hover in css
- Category
- CSS
- Title
- css background color transition
- Category
- CSS
- Title
- Wrap the last word of a paragraph in span tags using jQuery
- Category
- CSS
- Title
- coding that removes list marker from nav in css
- Category
- CSS
- Title
- css disabled
- Category
- CSS
- Title
- css span to right of div
- Category
- CSS
- Title
- rel css
- Category
- CSS
- Title
- background image with color overlay gradient css
- Category
- CSS
- Title
- css flex property
- Category
- CSS
- Title
- css how to style a div
- Category
- CSS
- Title
- neomorphic box
- Category
- CSS
- Title
- html link to css in another folder
- Category
- CSS
- Title
- css to hide scrollbar
- Category
- CSS
- Title
- css transition on hover
- Category
- CSS
- Title
- vue scss
- Category
- CSS
- Title
- loading screen svg and css animation
- Category
- CSS
- Title
- nth-child() css
- Category
- CSS
- Title
- font weight css
- Category
- CSS
- Title
- how to hover over an individual cell in table css
- Category
- CSS
- Title
- header html css
- Category
- CSS
- Title
- select first div css
- Category
- CSS
- Title
- css disable mouse events
- Category
- CSS
- Title
- css child multiple of 3
- Category
- CSS
- Title
- ram
- Category
- CSS
- Title
- add css file in html
- Category
- CSS
- Title
- border-box css
- Category
- CSS
- Title
- create dynamic navigation menu css
- Category
- CSS
- Title
- css vw scrollbar
- Category
- CSS
- Title
- make image scale based on screen size
- Category
- CSS
- Title
- hide scrollbar html css
- Category
- CSS
- Title
- change the weight of a bold font css
- Category
- CSS
- Title
- css comment tag
- Category
- CSS
- Title
- target css by form name
- Category
- CSS
- Title
- css remove blue outline button
- Category
- CSS
- Title
- css font color
- Category
- CSS
- Title
- how to clear floats
- Category
- CSS
- Title
- generate random grid in css
- Category
- CSS
- Title
- css psedo class
- Category
- CSS
- Title
- remove html scroll bar
- Category
- CSS
- Title
- Are HTML and Css programming languages?
- Category
- CSS
- Title
- remove border select css
- Category
- CSS
- Title
- html hide list bullet
- Category
- CSS
- Title
- aliceblue hex
- Category
- CSS
- Title
- css keep background image from scrolling
- Category
- CSS
- Title
- css font families
- Category
- CSS
- Title
- css justify content
- Category
- CSS
- Title
- how to create popup css
- Category
- CSS
- Title
- how to change button gradient
- Category
- CSS
- Title
- transition prefixes css
- Category
- CSS
- Title
- text border css
- Category
- CSS
- Title
- adding shadow to a div
- Category
- CSS
- Title
- how to use visited hover active and visited in css
- Category
- CSS
- Title
- update npm
- Category
- CSS
- Title
- how to use a blank space with grid template areas css
- Category
- CSS
- Title
- sass mixin
- Category
- CSS