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

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

My Project

Hey Friends , I want to share a project I recently made. This is a responsive design. I have used media queries and used two media queries. I want to know what changes I can made at these pages to make my page looks good, take less loading time and so on. One more thing - How can i reduce to number of line of code to achieve the same output. So please reply after seeing my project. Thanks Friends . You are all awesome really. You have been so helpful. :) This is my html code:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Broadway</title>
    <link rel="stylesheet" type="text/css" href="BWCSS.css">
    <link href='http://fonts.googleapis.com/css?family=Raleway:400, 600' rel='stylesheet' type='text/css'>
    <link href='normalize.css' rel='stylesheet' type='text/css'>
    <link href='Broadway.css' type="text/css" rel="stylesheet">

</head>

<body>
    <header class="main-header">
        <div class="container">
            <!-- main-nav -->
            <nav>
                <ul class="main-nav">
                    <li><a href="#">About</a></li>
                    <li><a href="#">Work</a></li>
                    <li><a href="#">Team</a></li>
                    <li><a href="#">Contact</a></li>
                </ul>
            </nav>
        </div>
    </header>
    <!--Title-->
    <div class="main">
        <div class="wrapper">
            <h1 class="main-title">We are broadway</h1>
            <!-- button -->
            <a href="#" id="button">Get started</a>
        </div>
    </div>
    <!-- container -->
    <section>
        <div class="container">
            <div class="col">
                <!-- logo -->
                <img src="https://s3.amazonaws.com/codecademy-content/projects/broadway/design.svg" width="40px" height="40px">
                <h2>DESIGN</h2>
                <p>Make your projects look great and interact beautifully.</p>
                <a href="#" class="btn-default">Learn More</a>
            </div>
            <!-- <hr /> -->
            <div class="col">
                <img src="https://s3.amazonaws.com/codecademy-content/projects/broadway/develop.svg" width="40px" height="40px">  
                <h2>DEVELOP</h2>
                <p>Use modern tools to turn your design into a web site</p>
                <a href="#" class="btn-default">Learn More</a>
            </div>
            <!-- <hr /> -->
            <div class="col">
                <img src="https://s3.amazonaws.com/codecademy-content/projects/broadway/deploy.svg" width="40px" height="40px">
                <h2>DEPLOY</h2>
                <p>Use modern tools to turn your design into a web site</p>
                <a href="#" class="btn-default">Learn More</a>
            </div>

        </div>
    </section>
    <footer>
        <p id="copyright">&copy; BROADWAY 2014</p>
    </footer>
</div>
</body>
</html>

This is my Broadway.css-

html,body{
    margin: 0;
    padding: 0;
    font-family: 'Raleway', sans-serif
}

.main-header{
    background-color:#333333;
    text-align: center;
    height: 180px;

}

.main-nav{
    margin:0; /*Default margin: 1em , so needs to set 0 to remove margin. */
 }

li{
    list-style: none;
    padding-top: .8em;
    padding-bottom: .8em;

}

a{
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 500;
    display: block;

}


/*------_____Main_____------*/

/*------_____With Positioning_____--------*/


.main{
    height:560px;
    background-image: url(http://s3.amazonaws.com/codecademy-content/projects/broadway/bg.jpg);
    background-size: cover;
    text-align: center;
    position: relative;

}
.wrapper{
    position: absolute;
    width: 100%;
    top: 15%;

}
.main-title{
    text-transform: uppercase;
    font-size: 3.5em;
    margin-bottom: 1.2em;
    letter-spacing: 1px;
}

#button{
    padding: 10px 24px;
    background-color: #333333;
    display: inline;
    font-weight: 600;
    letter-spacing:1px; 
}

/*------Column------*/


section .container{
        text-align: center;

}
.col{
    width: 75%;
    margin:2em auto;

}

.btn-default{
    padding: 6px 20px;
    border: 1px solid grey;
    display: inline;
    color: #333333;
    font-size: .6em;
}

/*-----footer-----*/

footer{
    height: 85px;
    background-color: #333333;
    color: #ffffff;

}

footer p{
    padding: 1.5em 5em;
    font-size: .8em;
}


/*Pseudo Classes*/

a:hover{
    color: #e62739;
}


/*Media Quaries*/

@media(min-width: 769px){


/*-----Main-Header-----*/

    .main-nav,
    .main-nav li{
        display: inline-block;  
    }

    .main-nav{
        margin: 1em 3em;
    }

    .main-nav li{
        margin: .5em;
        padding: .3em;
    }

    .main-header{
        height: 4.5em;

    }

    .main-header .container{
        text-align: left;
    }



/*-----Section------*/


    section .container{
        height: 340px;
    }


    .col{
        display: inline-block;
        width: 180px;          /*I tried percentages and em value too here, but that doesn't fit*/
        margin-left: 1em;
        vertical-align: top;
        margin-top: 4em;

    }

    .col p{
        margin-bottom: 1.8em;
    }

}


@media(min-width: 1050px){

    /*------Main-header------*/


    .main-nav{
        margin-left: 8em;
    }

    /*-----Main-----*/          

    .main{
        height: 820px;
    }



    #button{
    padding: 16px 40px;
    background-color: #333333;
    display: inline;

}

    .main-title{
        font-size: 4.5em;
    }


    /*------Section------*/

    section .container{
        width: 90%;
        margin: 0 auto;
    }

    .col{
        width: 220px;
        margin-left: 3.5em;
    }


    /*-----footer-----*/

    footer p{
        padding: 2em 10em;
    }

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Looks like you've done a great job with the project so far. :)

Rather than try to list everything from the top of my head I'd like to point you in the direction ofthe Front End Optimisation course which will teach you everything you need to know to reduce your bandwidth and page loading times.

Website Optimisation - https://teamtreehouse.com/library/website-optimization Front End Web Optimisation Workflow - https://teamtreehouse.com/library/front-end-web-optimization-workflow Introduction to Front End Performance - https://teamtreehouse.com/library/introduction-to-front-end-performance-optimization

Good luck!

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

Thanks Jonathan Grieve . Before website optimisation course , in Front End Path , there is "Bootstrap 4 " course. Is it necessary to complete "bootstrap 4 " before "website optimisation" ?

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Not strictly neccessary no, but perhaps ideal :)

You can't do everything at once but if you start the courses now you'll get a firm foundation on how what you do affects page load speeds and traffic.

You can take the courses in the track in any order you please though.