Skip to content

Commit c04b638

Browse files
e200Diego Jara
authored andcommitted
Added flexbox to .vue-avatar--wrapper so its content stays exactly on the xy middle (eliep#32)
* Added flexbox xy align support
1 parent a788e66 commit c04b638

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/Avatar.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
</div>
55
</template>
66

7+
<style lang="css">
8+
.vue-avatar--wrapper {
9+
display: flex;
10+
align-items: center;
11+
justify-content: center;
12+
}
13+
</style>
14+
715
<script>
816
export default {
917
name: 'avatar',
@@ -72,9 +80,7 @@ export default {
7280
const style = {
7381
width: `${this.size}px`,
7482
height: `${this.size}px`,
75-
borderRadius: this.rounded ? '50%' : 0,
76-
textAlign: 'center',
77-
verticalAlign: 'middle'
83+
borderRadius: this.rounded ? '50%' : 0
7884
}
7985
8086
const imgBackgroundAndFontStyle = {
@@ -85,8 +91,8 @@ export default {
8591
backgroundColor: this.background,
8692
font: Math.floor(this.size / 2.5) + 'px/100px Helvetica, Arial, sans-serif',
8793
fontWeight: 'bold',
88-
color: this.fontColor,
89-
lineHeight: `${(this.size + Math.floor(this.size / 20))}px`
94+
lineHeight: `${(this.size + Math.floor(this.size / 20))}px`,
95+
color: this.fontColor
9096
}
9197
9298
const backgroundAndFontStyle = (this.isImage)

0 commit comments

Comments
 (0)