felixarntz/theme-boilerplate

View on GitHub
assets/src/sass/header/_custom-header.scss

Summary

Maintainability
Test Coverage
.site-custom-header {
    position: relative;
    color: $color__text-header;
    background-color: $color__background-header;

    a {
        color: $color__link-header;

        &:visited {
            color: $color__link-header-visited;
        }

        &:hover,
        &:focus,
        &:active {
            color: $color__link-header-hover;
        }
    }

    &.text-left > .site-component-inner {
        text-align: left;
    }

    &.text-center > .site-component-inner {
        text-align: center;
    }

    &.text-right > .site-component-inner {
        text-align: right;
    }

    .has-header-image &,
    .has-header-video &,
    .has-page-header & {
        display: table;
        width: 100%;
        height: 10rem;

        @media (min-width: $site_breakpoint) {
            height: 16rem;
        }

        > .site-header-media {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 2;
            overflow: hidden;

            img,
            video,
            iframe {
                position: absolute;
                top: 50%;
                left: 0;
                display: block;
                width: 100%;
                min-width: 100%;
                transform: translateY(-50%);
            }
        }

        > .site-component-inner {
            position: absolute;
            top: 50%;
            left: 50%;
            z-index: 3;
            transform: translate(-50%, -50%);
            width: 100%;
        }
    }

    .site-page-header-content {
        h1 {
            @include font-size(1.8);

            margin: 0;

            & + * {
                padding: (0.5 * $spacing_vertical) 0 0;
            }
        }

        .entry-title,
        .entry-meta {
            margin: 0;
        }
    }
}