So I´ve made a CSS hexagon/honeycomb grid based on set math equations but I can´t seem to make it flexible.
Can´t seem to convert grid-auto-rows (.hexGridA and . hexGridB) from px to % in a meaningful way. What am I doing wrong?
.hexGrid {
width: 1000px; /* original value */ /* <=== WANT TO CHANGE THIS TO FLEXIBLE UNITS! */
margin: 1%;
background-color: mediumaquamarine;
}
.hexGridA {
width: 96%; /* % of .hexGrid.width: (.hex.width x 0.75) x (..grid-auto-rows x2) + ((.hex.width x 0.1) x 3), for size + space between hexes */
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: 100px; /* original value */ /* <=== WANT TO CHANGE THIS TO FLEXIBLE UNITS! */
margin-top: 0.5%; /* ..grid-auto-rows x 0.05, for space between hexes verticaly, .hexGridA + .hexGridB work in conjunction */
background-color: gold;
}
.hexGridB {
width: 96%;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: 100px; /* original value */ /* <=== WANT TO CHANGE THIS TO FLEXIBLE UNITS! */
margin-left: 16%; /* (.hex.width x 0.75) + (..grid-auto-rows x 0.10), for size + space between hexes (.hexGridA and .hexGridB) */
margin-top: 0.5%;
background-color: pink;
}
https://codepen.io/AtomicLynx/pen/QWGdJYz
https://github.com/AtomicLynx/CSSHexagonGrid-wClip-Path
Thanks!