The following hexagonal grid (with fixed width
and height
) should fit into the initial window size of the browser.
Users should be able to zoom in arbitrarily (with both pinch-to-zoom and/or keyboard shortcuts), but in the initial state, the grid should just about fill the window size.
AFAIK, a responsive design disallows keyboard zooming (such as CMD +
on MacOS) – so this is not what I'm looking for.
HTML (DEMO)
<div id="wrapper">
<div class="hex-row">
<div class="hexagon"></div>
<div class="hexagon"></div>
<div class="hexagon"></div>
<div class="hexagon"></div>
<div class="hexagon"></div>
</div>
<div class="hex-row even">
<div class="hexagon"></div>
<div class="hexagon"></div>
<div class="hexagon"></div>
<div class="hexagon"></div>
<div class="hexagon"></div>
</div>
</div>
CSS
.hexagon {
position: relative;
width: 250px;
height: 144.34px;
background-color: #33cc99;
margin: 72.17px 0;
float: left;
margin-left: 5.5px;
margin-bottom: 5.5px;
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
width: 0;
border-left: 125px solid transparent;
border-right: 125px solid transparent;
}
.hexagon:before {
bottom: 100%;
border-bottom: 72.17px solid #33cc99;
}
.hexagon:after {
top: 100%;
width: 0;
border-top: 72.17px solid #33cc99;
}
.hex-row {
clear: left;
width: 289vh;
}
.hex-row.even {
margin-left: 128px;
width: 289vh;
}
This is what I get vs. the desired effect (on the right):
It should not necessarily be responsive when changing the size of the window manually.
I tried to outsmart the grid with a wrapper, but no success. A short explanation on what's going on here, would be helpful:
html,
body {
height: 100%;
min-height: 100%;
margin: 0;
padding: 0;
}
#wrapper {
height: 100%;
min-height: 100%;
}
I wonder if there is any kind of automatically "zooming out" when opening the page?