Simple Grid - pure CSS

Size
2,159 Kb
Views
36,432

How do I make an simple grid - pure css?

What is a simple grid - pure css? How do you make a simple grid - pure css? This script and codes were developed by FerdousAlQuraeshi on 14 September 2022, Wednesday.

Simple Grid - pure CSS Previews

Simple Grid - pure CSS - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple Grid - pure CSS</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container grid-pad"> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-12">grid#1 </div> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-12">grid#2</div> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">grid#3</div> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">grid#4</div>
</div>
</body>
</html>

Simple Grid - pure CSS - Script Codes CSS Codes

*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
}
:root{ --laal: red; --bg-color-odd: #bfbfbf; --bg-color-even: #d9d9d9;
}
.container{ width: 100%; margin: 0 auto;
/* outline: 5px dashed green; */
}
.container:after { content: ""; display: table; clear: both;
}
[class*="col-"] { float: left; padding: 15px; outline: 1px dashed red; background-color: var(--bg-color-odd); text-align: center; }
[class*="col-"]:nth-child(even){ background-color: var(--bg-color-even);
}
/* =========================================== Declaring Common Grids Patterns on Fallback
==============================================*/
.col-1 { width: calc(1/12*100%);
}
.col-2 { width: calc(2/12*100%);
}
.col-3 { width: calc(3/12*100%);
}
.col-4 { width: calc(4/12*100%);
}
.col-5 { width: calc(5/12*100%);
}
.col-6 { width: calc(6/12*100%);
}
.col-7 { width: calc(7/12*100%);
}
.col-8 { width: calc(8/12*100%);
}
.col-9 { width: calc(9/12*100%);
}
.col-10 { width: calc(10/12*100%);
}
.col-11 { width: calc(11/12*100%);
}
.col-12 { width: calc(12/12*100%);
}
/* =============================================== for Breakpoint management with @madiaQueries
==================================================*/
@media (min-width: 1200px) { .col-lg-1 { width: calc(1/12*100%); } .col-lg-2 { width: calc(2/12*100%); } .col-lg-3 { width: calc(3/12*100%); } .col-lg-4 { width: calc(4/12*100%); } .col-lg-5 { width: calc(5/12*100%); } .col-lg-6 { width: calc(6/12*100%); } .col-lg-7 { width: calc(7/12*100%); } .col-lg-8 { width: calc(8/12*100%); } .col-lg-9 { width: calc(9/12*100%); } .col-lg-10 { width: calc(10/12*100%); } .col-lg-11 { width: calc(11/12*100%); } .col-lg-12 { width: calc(12/12*100%); }
}
@media (min-width: 992px) and (max-width:1199px) { .col-md-1 { width: calc(1/12*100%); } .col-md-2 { width: calc(2/12*100%); } .col-md-3 { width: calc(3/12*100%); } .col-md-4 { width: calc(4/12*100%); color: var(--laal); } .col-md-5 { width: calc(5/12*100%); } .col-md-6 { width: calc(6/12*100%); } .col-md-7 { width: calc(7/12*100%); } .col-md-8 { width: calc(8/12*100%); } .col-md-9 { width: calc(9/12*100%); } .col-md-10 { width: calc(10/12*100%); } .col-md-11 { width: calc(11/12*100%); } .col-md-12 { width: calc(12/12*100%); }
}
@media (min-width: 768px) and (max-width: 991px) { .col-sm-1 { width: calc(1/12*100%); } .col-sm-2 { width: calc(2/12*100%); } .col-sm-3 { width: calc(3/12*100%); } .col-sm-4 { width: calc(4/12*100%); } .col-sm-5 { width: calc(5/12*100%); } .col-sm-6 { width: calc(6/12*100%); } .col-sm-7 { width: calc(7/12*100%); } .col-sm-8 { width: calc(8/12*100%); } .col-sm-9 { width: calc(9/12*100%); } .col-sm-10 { width: calc(10/12*100%); } .col-sm-11 { width: calc(11/12*100%); } .col-sm-12 { width: calc(12/12*100%); }
}
@media (min-width: 480px) and (max-width: 767px) { .col-xs-1 { width: calc(1/12*100%); } .col-xs-2 { width: calc(2/12*100%); } .col-xs-3 { width: calc(3/12*100%); } .col-xs-4 { width: calc(4/12*100%); } .col-xs-5 { width: calc(5/12*100%); } .col-xs-6 { width: calc(6/12*100%); } .col-xs-7 { width: calc(7/12*100%); } .col-xs-8 { width: calc(8/12*100%); } .col-xs-9 { width: calc(9/12*100%); } .col-xs-10 { width: calc(10/12*100%); } .col-xs-11 { width: calc(11/12*100%); } .col-xs-12 { width: calc(12/12*100%); }
}
@media (max-width: 479px){ [class*="col-"] { width: calc(12/12*100%); }
}
Simple Grid - pure CSS - Script Codes
Simple Grid - pure CSS - Script Codes
Home Page Home
Developer FerdousAlQuraeshi
Username ferdous-al-quraeshi
Uploaded September 14, 2022
Rating 3
Size 2,159 Kb
Views 36,432
Do you need developer help for Simple Grid - pure CSS?

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!

FerdousAlQuraeshi (ferdous-al-quraeshi) Script Codes
Create amazing blog posts with AI!

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!