I would like to center the Dasboard h1 in the attached markup. It is not possible for me to know the size of the div or is it possible for me to set height: 100% for every preceding div for this.
I would have thought this was possible with flexbox but every example I see has height 100% or height: 100vh in all the parent elements. I could just use display: table or dispaly: table-cell if that was the case.
html {
min-height: 100%;
position: relative;
}
body {
height: 100%;
background-color: #f7f7f4;
}
#root {
height: 100%;
padding-bottom: 170px;
}
.wrapper {
max-width: 750px;
}
.grid {
list-style: none;
margin: 0;
padding: 0;
margin-left: -30px;
}
.grid__item {
display: inline-block;
padding-left: 30px;
vertical-align: top;
width: 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.one-half {
width: 50%;
}
.private-banner__container {
height: 98px;
}
.private-banner__layout {
width: 100%;
height: 100%;
display: table;
}
.private-banner__right, .private-banner__left {
display: table-cell;
vertical-align: middle;
}
.footer__footer {
padding-top: 48px;
padding-bottom: 48px;
}
ul {
margin-left: 38px;
margin-left: 2.375em;
}
.footer__footer ul li:not(last-of-type) {
margin-right: 48px;
}
.footer__footer li {
display: inline;
}
<html lang="en">
<body>
<div id="root">
<header role="banner">
<div class="wrapper private-banner__container">
<div class="grid private-banner__layout">
<div class="grid__item one-half private-banner__left"><h1>Logo</h1></div>
<div class="grid__item one-half private-banner__right"><a href="/business/dashboard">Home</a><a class="link__default" tabindex="0">Log Out</a></div>
</div>
</div>
</header>
<div>
<div class="wrapper">
<div class="grid">
<div class="grid__item ">
<h1>Dashboard</h1></div>
</div>
</div>
</div>
<footer class="footer__footer">
<div class="wrapper">
<div class="grid">
<div class="grid__item ">
<ul>
<li><a target="_blank" href="/static/about">About</a></li>
<li><a target="_blank" href="/static/accessibility">Accessibility</a></li>
<li><a target="_blank" href="/static/cookies">Cookies</a></li>
<li><a target="_blank" href="/static/privacy">Privacy</a></li>
</ul>
</div>
</div>
</div>
</footer>
</div>
</body>
</html>
` element.
– Rob Jan 30 '18 at 19:37