vycentrovať div V css
.container {
display: flex;
justify-content: center;
align-items: center;
}
centrum div horizontálne a vertikálne
.parent {
position: relative;
}
.child {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
ako vycentrovať div vertikálne a horizontálne
.container{
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: /* Define the width here; */
height: /* Define the height here; */
}
/*You have to define the width and height! */
CSS centrum horizontálne a vertikálne
.parent {
position: relative;
}
.child {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
CSS zarovnajte vertikálne a horizontálne
.parent-class {
display: flex;
align-items: center;
justify-content: space-around;
}
CSS stred vertikálne a horizontálne
body {
display: flex;
min-height: 100vh;
flex-direction: column;
justify-content: center;
align-items: center;
}
/* to make "align-items: center" work: use "min-height: 100vh;"
100vh = 100% Viewport Height */