Simple Grid
How do I make an simple grid?
A very simple grid system. No bells or whistles. Just a responsive grid in under 30 lines of CSS.. What is a simple grid? How do you make a simple grid? This script and codes were developed by Dan on 07 January 2023, Saturday.
Simple Grid - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple Grid</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- Classes a1-a12 only used for example purposes in this Pen. Not needed in a real project. -->
<div class="grid"> <div class="a1 col-4"></div> <div class="a2 col-4"></div> <div class="a3 col-4"></div> <div class="a4 col-4"></div> <div class="a5 col-4"></div> <div class="a6 col-4"></div> <div class="a7 col-4"></div> <div class="a8 col-4"></div> <div class="a9 col-4"></div> <div class="a10 col-4"></div> <div class="a11 col-4"></div> <div class="a12 col-4"></div>
</div>
</body>
</html>
Simple Grid - Script Codes CSS Codes
/* Give container div ".grid" class to set a max-width for the grid */
.grid { max-width: 900px; margin: 0 auto;
}
/* Use ".col-3" class for 3 columns max
Use ".col-4" class for 4 columns max */
.col-3,
.col-4 { width: 90%; margin: 1em auto;
/* "border-box" allows the grid to work when divs have borders */ box-sizing: border-box;
}
@media (min-width: 480px) { .col-3, .col-4 { width: 46%; float: left; margin: 2%; }
}
@media (min-width: 768px) { .col-3, .col-4 { width: 30%; margin: 1.65%; }
}
/* Not needed for 3 column max grid */
@media (min-width: 992px) { .col-4 { width: 23%; margin: 1%; }
}
/* The code below is just for example use in this Pen to make the divs show up. */
.a1 { background-color: red; height: 5em;
}
.a2 { background-color: blue; height: 5em;
}
.a3 { background-color: pink; height: 5em;
}
.a4 { background-color: yellow; height: 5em;
}
.a5 { background-color: purple; height: 5em;
}
.a6 { background-color: green; height: 5em;
}
.a7 { background-color: black; height: 5em;
}
.a8 { background-color: gray; height: 5em;
}
.a9 { background-color: orange; height: 5em;
}
.a10 { background-color: #CCC; height: 5em;
}
.a11 { background-color: #888; height: 5em;
}
.a12 { background-color: #BBB; height: 5em;
}
Developer | Dan |
Username | danbuda |
Uploaded | January 07, 2023 |
Rating | 3 |
Size | 1,960 Kb |
Views | 6,072 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Sass Mixin Example | 1,944 Kb |
Sticky Footer | 1,655 Kb |
Simple React Router | 2,707 Kb |
CSS Grid Using Inline-Block | 1,800 Kb |
Sorting Items While Ignoring Articles | 3,002 Kb |
React Routing with this.props.children | 2,725 Kb |
Just Some Buttons | 1,568 Kb |
My First Mixin | 2,017 Kb |
Simple Collapsable Navbar | 2,667 Kb |
React Collapsable Navbar | 3,531 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Tumblr API | Juanv911 | 2,436 Kb |
Ripples in water | Nobitagit | 2,704 Kb |
A Pen by Manoz | Manoz | 2,424 Kb |
3D-box | Parthviroja | 2,346 Kb |
Drag and Drop Quiz | Cgspicer | 3,837 Kb |
Cars going | Netoguimaraes | 1,699 Kb |
Clock | Martingrand | 3,520 Kb |
Practice using Wixel | Emnk | 3,057 Kb |
A Pen by Kenny Mark | Kennymark | 5,574 Kb |
Starfield using KineticJS | Asp | 3,512 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!