#css #frontend
Html struktura:
<div class="container">
<div class="centered-div">Markazlangan kontent</div>
</div>
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
display: grid;
place-items: center;
height: 100vh;
}
.container {
position: relative;
height: 100vh;
}
.centered-div {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
// Gorizontal markazlash uchun, margin: auto
.centered-div {
width: 50%;
margin: 0 auto;
}
// Inline yoki inline-block elementlari uchun
.container {
text-align: center;
line-height: 100vh;
}
.centered-div {
display: inline-block;
vertical-align: middle;
line-height: normal;
}
@frontend