add and style footer, keep footer always on bottom of the viewport

This commit is contained in:
Benedikt Rötsch
2017-09-26 17:59:56 +02:00
committed by Benedikt Rötsch
parent 500b103c03
commit ceca213bfe
8 changed files with 339 additions and 117 deletions

View File

@@ -0,0 +1,66 @@
#footer {
margin: var(--grid-gutter) 0;
padding-top: var(--grid-gutter);
border-top: 2px solid var(--color-bg-separator);
& .upper {
display: flex;
& > * {
display: flex;
align-items: center;
}
& .navigation {
flex: 1 0 auto;
font-size: 0.9em;
& ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
& li {
margin: 0;
& + li {
margin-left: calc(var(--grid-gutter) * 2);
}
}
}
}
& .apps {
flex: 0 0 auto;
& a {
display: inline-block;
width: 150px;
& + a {
margin-left: var(--grid-gutter);
}
& img {
width: 100%;
height: auto;
}
}
}
}
& .lower {
display: flex;
& .disclaimer {
flex: 1 0 auto;
font-size: 0.7em;
color: var(--color-text-grey);
}
& .social {
flex: 0 0 auto;
}
}
}

View File

@@ -6,6 +6,21 @@ body {
line-height: var(--line-height); line-height: var(--line-height);
} }
#main {
display: flex;
flex-direction: column;
min-height: 100vh;
}
#main__header {
flex: 0 0 auto;
}
#main__content {
flex: 1 0 auto;
}
#main__footer {
flex: 0 0 auto;
}
.wrapper { .wrapper {
max-width: 1024px; max-width: 1024px;
margin: 0 auto; margin: 0 auto;

View File

@@ -1,10 +1,9 @@
.header { #header {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin-top: var(--grid-gutter); margin: var(--grid-gutter) 0;
padding-bottom: var(--grid-gutter); padding-bottom: var(--grid-gutter);
margin-bottom: var(--grid-gutter);
border-bottom: 2px solid var(--color-bg-separator); border-bottom: 2px solid var(--color-bg-separator);
@@ -34,43 +33,8 @@
flex: 1 0 auto; flex: 1 0 auto;
} }
} }
}
.header__navarea { & .navigation {
& form {
display: flex;
flex-wrap: wrap;
@media (--breakpoint-desktop) {
justify-content: flex-end;
}
& > * {
flex: 0 0 auto;
}
& fieldset {
padding: 0.2em 1em;
margin: 0;
border: none;
background: var(--color-bg-grey);
color: var(--color-text-grey);
border-radius: var(--border-radius);
font-size: 0.8em;
& + fieldset {
margin-left: var(--grid-gutter)
}
& label + select {
margin-left: 0.5em;
}
}
}
}
.navigation {
& nav {
& ul { & ul {
display: flex; display: flex;
list-style: none; list-style: none;
@@ -111,3 +75,36 @@
} }
} }
.header__navarea {
& form {
display: flex;
flex-wrap: wrap;
@media (--breakpoint-desktop) {
justify-content: flex-end;
}
& > * {
flex: 0 0 auto;
}
& fieldset {
padding: 0.2em 1em;
margin: 0;
border: none;
background: var(--color-bg-grey);
color: var(--color-text-grey);
border-radius: var(--border-radius);
font-size: 0.8em;
& + fieldset {
margin-left: var(--grid-gutter)
}
& label + select {
margin-left: 0.5em;
}
}
}
}

View File

@@ -5,6 +5,7 @@
@import './typography'; @import './typography';
@import './global'; @import './global';
@import './header'; @import './header';
@import './footer';
@import './homepage'; @import './homepage';
@import './course'; @import './course';

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -468,6 +468,35 @@ body {
line-height: 1.5em; line-height: 1.5em;
} }
#main {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
min-height: 100vh;
}
#main__header {
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
}
#main__content {
-webkit-box-flex: 1;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
}
#main__footer {
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
}
.wrapper { .wrapper {
max-width: 1024px; max-width: 1024px;
margin: 0 auto; margin: 0 auto;
@@ -643,34 +672,31 @@ body {
font-weight: bold; font-weight: bold;
} }
.header { #header {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
-ms-flex-wrap: wrap; -ms-flex-wrap: wrap;
flex-wrap: wrap; flex-wrap: wrap;
margin-top: 16px; margin: 16px 0;
margin: 1rem 0;
margin-top: 1rem;
padding-bottom: 16px; padding-bottom: 16px;
padding-bottom: 1rem; padding-bottom: 1rem;
margin-bottom: 16px;
margin-bottom: 1rem;
border-bottom: 2px solid #f2f5f7; border-bottom: 2px solid #f2f5f7;
} }
@media (min-width: 700px) { @media (min-width: 700px) {
.header { #header {
-ms-flex-wrap: nowrap; -ms-flex-wrap: nowrap;
flex-wrap: nowrap; flex-wrap: nowrap;
} }
} }
.header .header__logo, #header .header__logo,
.header .header__navarea { #header .header__navarea {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
@@ -679,7 +705,7 @@ body {
flex: 0 0 100%; flex: 0 0 100%;
} }
.header .header__logo { #header .header__logo {
-webkit-box-align: center; -webkit-box-align: center;
-ms-flex-align: center; -ms-flex-align: center;
align-items: center; align-items: center;
@@ -687,14 +713,14 @@ body {
@media (min-width: 700px) { @media (min-width: 700px) {
.header .header__logo { #header .header__logo {
-webkit-box-flex: 0; -webkit-box-flex: 0;
-ms-flex: 0 0 200px; -ms-flex: 0 0 200px;
flex: 0 0 200px; flex: 0 0 200px;
} }
} }
.header .header__navarea { #header .header__navarea {
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-box-direction: normal; -webkit-box-direction: normal;
-ms-flex-direction: column; -ms-flex-direction: column;
@@ -705,13 +731,60 @@ body {
@media (min-width: 700px) { @media (min-width: 700px) {
.header .header__navarea { #header .header__navarea {
-webkit-box-flex: 1; -webkit-box-flex: 1;
-ms-flex: 1 0 auto; -ms-flex: 1 0 auto;
flex: 1 0 auto; flex: 1 0 auto;
} }
} }
#header .navigation ul {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
list-style: none;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin: 0;
padding: 0;
}
@media (min-width: 700px) {
#header .navigation ul {
-webkit-box-pack: end;
-ms-flex-pack: end;
justify-content: flex-end;
}
}
#header .navigation ul li {
margin: 0;
}
#header .navigation ul li + li {
margin-left: 4px;
margin-left: 0.25rem;
}
#header .navigation ul li a {
display: block;
text-transform: uppercase;
font-weight: bold;
padding: 0.7em 1em;
color: #8091a5;
border-radius: 3px;
}
#header .navigation ul li a.active,
#header .navigation ul li a:hover {
background: #f7f9fa;
}
#header .navigation ul li a.active {
color: #2a303a;
}
.header__navarea form { .header__navarea form {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
@@ -754,51 +827,94 @@ body {
margin-left: 0.5em; margin-left: 0.5em;
} }
.navigation nav ul { #footer {
margin: 16px 0;
margin: 1rem 0;
padding-top: 16px;
padding-top: 1rem;
border-top: 2px solid #f2f5f7
}
#footer .upper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
#footer .upper > * {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
#footer .upper .navigation {
-webkit-box-flex: 1;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
font-size: 0.9em;
}
#footer .upper .navigation ul {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
list-style: none; list-style: none;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
@media (min-width: 700px) { #footer .upper .navigation ul li {
.navigation nav ul {
-webkit-box-pack: end;
-ms-flex-pack: end;
justify-content: flex-end;
}
}
.navigation nav ul li {
margin: 0; margin: 0;
} }
.navigation nav ul li + li { #footer .upper .navigation ul li + li {
margin-left: 4px; margin-left: 32px;
margin-left: 0.25rem; margin-left: 2rem;
} }
.navigation nav ul li a { #footer .upper .apps {
display: block; -webkit-box-flex: 0;
text-transform: uppercase; -ms-flex: 0 0 auto;
font-weight: bold; flex: 0 0 auto;
padding: 0.7em 1em; }
#footer .upper .apps a {
display: inline-block;
width: 150px;
}
#footer .upper .apps a + a {
margin-left: 16px;
margin-left: 1rem;
}
#footer .upper .apps a img {
width: 100%;
height: auto;
}
#footer .lower {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
#footer .lower .disclaimer {
-webkit-box-flex: 1;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
font-size: 0.7em;
color: #8091a5; color: #8091a5;
border-radius: 3px;
} }
.navigation nav ul li a.active, #footer .lower .social {
.navigation nav ul li a:hover { -webkit-box-flex: 0;
background: #f7f9fa; -ms-flex: 0 0 auto;
} flex: 0 0 auto;
.navigation nav ul li a.active {
color: #2a303a;
} }
.hero { .hero {

View File

@@ -4,7 +4,10 @@ html
title= title title= title
link(rel='stylesheet', href='/stylesheets/style.css') link(rel='stylesheet', href='/stylesheets/style.css')
body body
header.header.wrapper #main
#main__header
.wrapper
header#header
section.header__logo section.header__logo
a.logo--link(href='#') a.logo--link(href='#')
img(src='/images/logo.png' alt='Contentful University') img(src='/images/logo.png' alt='Contentful University')
@@ -21,19 +24,43 @@ html
select(name='locale' onChange='this.form.submit()') select(name='locale' onChange='this.form.submit()')
option(value='en-US') English option(value='en-US') English
option(value='de-DE') German option(value='de-DE') German
section.navigation nav.navigation
nav
ul ul
li li
a.active(href='/') Home a.active(href='/') Home
li li
a(href='/courses') Courses a(href='/courses') Courses
li li
a(href='/categories') Categories a(href='/about') About
li
a(href='/settings') Settings
#main__content
block content
#main__footer
.wrapper
footer#footer
.upper
nav.navigation
ul
li
a.active(href='/') Home
li
a(href='/courses') Courses
li li
a(href='/about') About a(href='/about') About
li li
a(href='/settings') Settings a(href='/settings') Settings
li .apps
a(href='/sitemap') Sitemap a(href='#')
block content img(src='/images/app-store-badge.png')
a(href='#')
img(src='/images/google-play-badge.png')
.lower
.disclaimer
p This website and the materials fond on it are for demo purposes using Contentful. You can use this to preview the content created on your Contentful account.
.social
p
a(href='#') FB
a(href='#') TW