1
我目前正在與景觀搭載Vue.js
Flex的框不是垂直和水平居中
的電子應用目前,我有這個(用於測試目的)
<template>
<div class="formWrapper">
<div class="inputGroup">
<span class="inputPrepend"><i class="fa fa-user"></i></span>
<input type="text" name="" value="">
</div>
</div>
</template>
<script>
export default {
}
</script>
<style scoped>
.formWrapper {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.inputGroup {
align-self: center;
}
</style>
我結束了這個結果:
但我似乎無法得到垂直居中的情況發生。
我已經確定所有的父元素有一個height: 100%;
,但仍不能讓它往下走,也是爲什麼我需要指定align-self
如果父柔性容器formWrapper
已指定center
爲align-items
和justify-content
謝謝。
謝謝,你是對的,使用100%是愚蠢的,應該是100vh/vw – Datsik