|
Как выровнить картинку по вертикали
Как выровнить картинку по вертикали
1. С помощью Flexbox
1 2 3 4 5
|
display: flex;
align-items: center;
justify-content: center;
|
2. C помощью абсолютного позиционирования
1 2 3 4 5 6
|
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
|
1 2 3 4 5 6 7 8 9 10 11 12
| .outer {
height: 100px;
position: relative;
}
.outer img {
position: absolute;
margin: auto;
left: 0;
top: 0;
bottom: 0;
right: 0;
} |
|