gpt4 book ai didi

html - Display Flex 将文本垂直顶部和图像居中对齐

转载 作者:搜寻专家 更新时间:2023-10-31 08:51:11 24 4
gpt4 key购买 nike

我正在尝试为 Flex Layout 设置图像只需要居中对齐而不是文本。

目前我有两个 flex 框,第一个框是文本,第二个是文本和图像,所以当我对齐元素时,两者也对齐中心,我只需要图像来对齐中心而不是文本。

flex-container {
border: 1px solid;
display: flex;
align-items: center;
}

.flex-item {
flex: 1 auto;
border: 1px solid green;
height: 100%;
display: flex;
justify-content: center;
}

.flex-center {
align-items: center;
}
<div class="flex-container">
<div class="flex-item">I'm top dog!
</div>
<div class="flex-item flex-center">
I want to be vertically centered! And I am!
</div>
</div>
<div class="flex-container">
<div class="flex-item">I'm top dog!Previous. Next. Image for Scented Lolly Dude Small Hardtop Pencil Case from Smiggle ... Tall Pencil Pack X24 any 2 for $20 Tall Pencil Pack X24 $12.95 AUD. Previous. Next. Image for Scented Lolly Dude Small Hardtop Pencil Case from Smiggle
... Tall Pencil Pack X24 any 2 for $20 Tall Pencil Pack X24 $12.95 AUD.
</div>
<div class="flex-item flex-center">
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxISEhUTEhMVFRUXFhcZFxgXFRoYFxoYFxcYGBcYFxcYHyggGBolHRgYITEhJykrLi4uGB8zODMtNygtLisBCgoKDg0OGhAQGi0lHyUvLS0tLS0vKystLS0tKy0uLS0tLS0tLS0tLS0tLSsyLy0tLTUrLS0rLi0tLS0tLS0tLf/AABEIANAA0AMBIgACEQEDEQH/xAAcAAACAwEBAQEAAAAAAAAAAAADBAACBQYBBwj/xABJEAACAQIEBAQCBQkDCwQDAAABAhEAAwQSITEFQVFhEyJxgTKRBlKhscEHFBUjQmKS0fByguEWM0Njc5SistLT8VSDs8JFU1X/xAAXAQEBAQEAAAAAAAAAAAAAAAAAAQID/8QAJREAAgICAwACAgIDAAAAAAAAAAECERIhAzFBE1EiYXHhI4Hw/9oADAMBAAIRAxEAPwD7j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fT9of3axGxmIXQqCO6/yil7uOcsrmzDLzBIkdG01HMdKWFF+nWcVxCmy5AllUsPVQTHuJHvQ3uZxYRGy+UOTEnKqgCOhJYQTMZdq588akEGy+oI+IHf2oWE4ll1Nq4TlVdI2QQN+5JpZlRZ22HtIoAXQDYTPuTzJ686P4YrjV43/q7n2V6n0iKnVXiOgkEe8EH2jvS0Z+NnRYSzGIvA/D4dpwfU3M3yyz71bAYQkB3I1JdVAOmbYsTu2WB0FczifpDnzDzgMgQ+XUeYlo1+qYp7/Khe/8FLRpqR0jWfcVm28CEvrr5GUkLyV0BAg8hkd9O1Z/+VSdG/hNKcR+kK3EKrmVhqjFZhoIE67akehNLRIqRvcOckwRGZRcmdTnYiI5QAoqvF1/VsPrQnuzBfxrnsPx1Q0w8C2iAZfqyW/D5UwfpAvR/wCD/Glosou+joXk+9VKHryrmLn0hMiEaATOmpEaR019dDSDYtiVIVlGYOcqzlcqyvkk6hpBk7EEwZpYXH9nW4rCq8HQOuqPElSOfcdvWlL2NXOVchWuWmVkn9pFYgr9ZSufXsKy14o2UBbbmBEu+vvA1NeXTiLy5QtsD0JI9JOhpZYxZ0Vi+ptpOoKLI6gqJ+ysfD4pksXLcw+d7ak9DChyN4y+Y1W3wrEsNXIEAQug09Kf4f8ARsgyTJ70sqjQ9wlTsDMxLEamBA9ABoBXV4RIFZ+A4dlrWVYoVL0tUqVKFJUqVKAE9uaVu4IHlT9eRQGQ3ClPKq/odOgrZipFAZA4Mn1RXo4On1RWvUoDJPB0+qKoeCWz+yK2alAYv6Bt/VFe/oG19UVs1KlAxv0Da+qPlXo4Fb+qPlWxUqgyl4LbH7Iq36It/VFadSlAyW4Mn1RXq8HT6orVqVKBnLwpOgo6YBB+yKaqVQCayI0AFBFmm68igKotXqVKA8NQV7UoD//Z"
/>
</div>
</div>

This是 Plunker 有人知道吗

预计

enter image description here

最佳答案

从此 div 中删除 flex-center

<div class="flex-item">
I want to be vertically centered! And I am!
</div>

将类保留在包含图像的 div

<div class="flex-item flex-center">
<img src="" />
</div>

将CSS中的.flex-center改为

.flex-center {
align-self: center;
}

Updated plunkr

关于html - Display Flex 将文本垂直顶部和图像居中对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45811588/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com