I\'m wondering how I would go about creating a layout with responsive squares. Each square would have vertically and horizontally aligned c
You could use vw (view-width) units, which would make the squares responsive according to the width of the screen.
A quick mock-up of this would be:
html,
body {
margin: 0;
padding: 0;
}
div {
height: 25vw;
width: 25vw;
background: tomato;
display: inline-block;
text-align: center;
line-height: 25vw;
font-size: 20vw;
margin-right: -4px;
position: relative;
}
/*demo only*/
div:before {
content: "";
position: absolute;
top: 0;
left: 0;
height: inherit;
width: inherit;
background: rgba(200, 200, 200, 0.6);
transition: all 0.4s;
}
div:hover:before {
background: rgba(200, 200, 200, 0);
}
1
2
3
4
5
6
7
8