Experimenting with FlexBox (for demonstration purposes only). I am facing a challenge in vertically centering text within the parent .top-nav-bar
. While using justify-content: space-between
, I have successfully aligned two elements horizontally, but I am struggling to center .contact
and .help
vertically inside .top-nav-bar
. Every attempt I make seems to push the text to the top edge of the page.
HTML:
header.section1.box
.top-nav-bar
.contact
p Lorem ipsum dolor sit amet
.help
p Lorem ipsum dolor sit amet
CSS:
.section1
background:
image: url(url/of/image.jpg)
size: cover
position: top center
repeat: no-repeat
attachment: fixed
.box
overflow: hidden
width: 100%
height: 100vh
background:
color: #90281F
.top-nav-bar
max-width: 1200px
width: 100%
height: 40px
margin: 0 auto
font-size: 0.813em
background: pink
display: flex
flex-direction: row
align-items: center
justify-content: space-between
.contact
background: red
.help
background: green