I've created the header and a section on my site. I want to center text within the section. I used Flexbox to center horizontally and vertically. In the screen shots you'll see that part of the "hero-text" section which should be below the header is behind the header. I know that I could fix this using positioning hacks but is there a better way?
Here is the HTML:
<body>
<header>
<a href="#"><img src="images/lookout-logo-small.png" alt="LookOut Software Logo" id="logo"></a>
<nav class="main-nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<section id="hero-text">
<h1>LookOut Software</h1>
<p>Made in Canada</p>
</section>
</body>
And the CSS:
header{
width: 100%;
background: white;
height: 4.75rem;
box-shadow: 0 0 2px rgba(6,8,8,0.15);
position: fixed;
top: 0px;
}
#logo{
margin: 1rem;
}
nav{
top: 0;
right: 0;
position: absolute;
margin: .5rem;
}
.main-nav ul{
list-style-type: none;
font-weight: bold;
}
.main-nav li{
display: inline-block;
margin: 0 .5rem;
}
.main-nav a{
text-decoration: none;
color: #3a3a3a;
font-size: 0.85rem;
}
a:hover{
text-decoration: none;
color: #FF6952;
border-bottom: 2px solid #30C0D8;
}
/* Content area */
#hero-text{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #FF6952;
}