3 ms·
??? .box { display: flex; align-items: center; justify-content: center; width: 500px; height: 500px; } .box div { width: 100px; height: 100px; }
by trs8080 5y ago
???
.box {
display: flex;
align-items: center;
justify-content: center;
width: 500px;
height: 500px;
}
.box div {
width: 100px;
height: 100px;
}
<div class="box">
<div>this is centered vertically and horizontally</div>
</div>
also, using tables for layout isn't semantically correct. it's like using `map` as a for loop. also, consider folks with disabilities who rely on screen readers.