Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

How can i display one element on top of each other?

HI,

This is the site I'm working on, here and you see navigaiton? You see the image and title? The ICON needs a class display block, BUT, the .fa icon has soo many properties, that I can't overwrite it. Now, I'm using Sass to do this, and putting an 'I' before, well, i don't know.

How woudl you achieve the display block on dektop + on the icon?

Here's my code

// ==========================================================================
// Nav
// ==========================================================================

%nav-item {
    display: block;
    font-size: 1em;
    margin: 0;

    @include mq(medium-up) {
        float: left;
        padding-top: 0;
        padding-bottom: 0;
    }
}

%nav-link {
    color: $nav-text;
    padding: 10px 15px;
    vertical-align: middle;
    text-decoration: none;
    text-transform: uppercase;
    display: block;
    font-weight: $font-weight--light;
    transition-property: color, background-color;
    transition-duration: $nav-tran;

    @include mq(medium-up) {
        height: 88px;
    }
}

%nav-item-on {
    background: $nav-background;
    color: $white;
}

%fa {
    display: block;
}
// ==========================================================================
// Navigation
// ==========================================================================

.nav {

    @include element(item) {
        @extend %nav-item;

        @include modifier(current) {
            @extend %nav-item;

            a {
                @extend %nav-link;
                @extend %nav-item-on;
            }
        }

        a {
            @extend %nav-link;
            &:hover {
                @extend %nav-item-on;
            }
        }
    }

    @include element(icon){
        @extend %fa;
        display: block;
    }

}

.nav-collapse{
    @include mq(medium-below) {
        display: none;
    }
}
<!-- HEADER
    ================================================== -->
    <header class="header">
    <div class="container">
    <div class="header__inner">

            <div class="header__home">
                <div class="header__logo">New News</div>

                <div class="header__hamburger show--bw-md">
                    <i class="fa fa-bars" aria-hidden="true"></i>
                </div>
            </div><!-- /header__home -->


            <nav class="header__navbar nav-collapse">
            <ul class="nav">
                <li class="nav__item--current">
                <a class="nav__link" href="">
                    <i class="fa fa-home nav__icon" aria-hidden="true"></i>
                    Home
                </a>
                </li>
                <li class="nav__item">
                <a class="nav__link" href="">
                    <i class="fa fa-newspaper-o nav__icon" aria-hidden="true"></i>
                    News
                </a>
                </li>
                <li class="nav__item">
                <a class="nav__link" href="">
                    <i class="fa fa-thumbs-o-up nav__icon" aria-hidden="true"></i>
                    Services
                </a>
                </li>
                <li class="nav__item">
                <a class="nav__link" href="">
                    <i class="fa fa-star-o nav__icon" aria-hidden="true"></i>
                    About
                </a>
                </li>
                <li class="nav__item">
                <a class="nav__link" href="">
                    <i class="fa fa-clone nav__icon" aria-hidden="true"></i>
                    Works
                </a>
                </li>
                <li class="nav__item">
                <a class="nav__link" href="">
                    <i class="fa fa-users nav__icon" aria-hidden="true"></i>
                    Team
                </a>
                </li>
                <li class="nav__item">
                <a class="nav__link" href="">
                    <i class="fa fa-envelope nav__icon" aria-hidden="true"></i>
                    Contact
                </a>
                </li>
            </ul>
            </nav>


    </div><!-- /header__inner -->
    </div><!-- /container -->
    </header>

Full code on gh-pages on github https://github.com/AurelianSpodarec/hcGoodHeadernSite/tree/gh-pages

How woudl you achieve the display block on the icon Sass way to it fit's what I'm doing?