Fluid Hexagonal Grid

Developer
Size
4,453 Kb
Views
54,648

How do I make an fluid hexagonal grid?

A fluid, responsive hexagonal grid in SCSS.For more techniques for creating fluid hexagons, checkout Flexagons. What is a fluid hexagonal grid? How do you make a fluid hexagonal grid? This script and codes were developed by Joey Hoer on 14 September 2022, Wednesday.

Fluid Hexagonal Grid Previews

Fluid Hexagonal Grid - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Fluid Hexagonal Grid</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div> <div class="hex"> <div>Hex Grid</div> </div>
</div>
</body>
</html>

Fluid Hexagonal Grid - Script Codes CSS Codes

@import url(//fonts.googleapis.com/css?family=Lilita+One);
.hex { background: #ff0; position: relative; overflow: hidden; visibility: hidden;
}
.hex:before { content: ''; position: absolute; visibility: visible; top: 0; bottom: 0; right: 0; left: 0; -webkit-transform: rotate(-30deg) skewX(30deg) scale(1.155, 0.866); transform: rotate(-30deg) skewX(30deg) scale(1.155, 0.866); background: inherit;
}
.hex:after { content: ''; display: block; padding-top: 115.4734411%;
}
.hex > * { visibility: visible;
}
@media (max-width: 499px) { .hex { float: left; width: 65.66667%; } .hex:nth-child(even) { margin-left: 34.33333%; margin-top: -16.95633%; margin-bottom: -16.95633%; } .hex:nth-child(odd) { margin-right: 34.33333%; } .hex:last-child { margin-bottom: 0; }
}
@media (min-width: 500px) and (max-width: 719px) { .hex { float: left; width: 49%; margin-right: 2%; } .hex:nth-child(3n+1) { margin-left: 25.5%; } .hex:nth-child(3n+1) { margin-right: 25.5%; } .hex:nth-child(3n+3) { margin-right: 0; } .hex:nth-child(3n+2), .hex:nth-child(3n+3) { margin-top: -12.14508%; margin-bottom: -12.14508%; } .hex:last-child { margin-bottom: 0; }
}
@media (min-width: 720px) and (max-width: 879px) { .hex { float: left; width: 32%; margin-right: 2%; } .hex:nth-child(5n+1) { margin-left: 17%; } .hex:nth-child(5n+2) { margin-right: 17%; } .hex:nth-child(5n+5) { margin-right: 0; } .hex:nth-child(5n+3), .hex:nth-child(5n+4), .hex:nth-child(5n+5) { margin-top: -7.2376%; margin-bottom: -7.2376%; } .hex:last-child { margin-bottom: 0; }
}
@media (min-width: 880px) and (max-width: 1099px) { .hex { float: left; width: 23.5%; margin-right: 2%; } .hex:nth-child(7n+1) { margin-left: 12.75%; } .hex:nth-child(7n+3) { margin-right: 12.75%; } .hex:nth-child(7n+7) { margin-right: 0; } .hex:nth-child(7n+4), .hex:nth-child(7n+5), .hex:nth-child(7n+6), .hex:nth-child(7n+7) { margin-top: -4.78387%; margin-bottom: -4.78387%; } .hex:last-child { margin-bottom: 0; }
}
@media (min-width: 1100px) { .hex { float: left; width: 18.4%; margin-right: 2%; } .hex:nth-child(9n+1) { margin-left: 10.2%; } .hex:nth-child(9n+4) { margin-right: 10.2%; } .hex:nth-child(9n+9) { margin-right: 0; } .hex:nth-child(9n+5), .hex:nth-child(9n+6), .hex:nth-child(9n+7), .hex:nth-child(9n+8), .hex:nth-child(9n+9) { margin-top: -3.31162%; margin-bottom: -3.31162%; } .hex:last-child { margin-bottom: 0; }
}
.hex > div { text-align: center; position: absolute; top: 50%; left: 0; right: 0; -webkit-transform: translateY(-50%); transform: translateY(-50%);
}
.container { margin: 0 2%; border: 1px dashed rgba(128, 128, 128, 0.35);
}
@media (min-width: 720px) { .container { width: 50%; margin: auto; }
}
.container:before, .container:after { content: ""; display: table;
}
.container:after { clear: both;
}
body { font: 0.825em/1.2 'Lilita One'; color: #222; text-transform: uppercase; background: #222;
}
*, *:before, *:after { box-sizing: border-box;
}
/* Center */
html, body { height: 100%;
}
html { display: table; width: 100%;
}
body { display: table-cell; vertical-align: middle; text-align: center;
}
Fluid Hexagonal Grid - Script Codes
Fluid Hexagonal Grid - Script Codes
Home Page Home
Developer Joey Hoer
Username joeyhoer
Uploaded September 14, 2022
Rating 3.5
Size 4,453 Kb
Views 54,648
Do you need developer help for Fluid Hexagonal Grid?

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!

Joey Hoer (joeyhoer) Script Codes
Create amazing web content 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!