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

Help me out with this template

Hello,

so recently I've finished a course "How to build a website" and I've been practicing my newly learned skills. I decided to try to reproduce this simple template, but I'm struggling with a few things. First of all, my navigation on the right side (aside) doesn't look the same. Second of all, how do I move that h2 tag in the header to the left a little bit? And what's that gray space at the bottom of the page? Why isn't it filled with gradient background? Other than that, I think everything is fine. It would be awesome if someone checked my HTML and CSS for any bad code. Thanks!

Template: http://www.oswd.org/design/preview/id/3697/

HTML:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Simple Beauty</title>
        <link rel="stylesheet" type="text/css" href="css/normalize.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />
    </head>
    <body>
        <div class="wrap">
            <header>
                <h1>Simple Beauty H1 Title or Logo</h1>
                <h2>... your slogan or tag line here</h2>
            </header>
            <div class="content">
                <article>
                    <h2>Simple Beauty H2 SubTitle</h2>
                    <p>
                        This site design is open source, so feel free to use it as you want, but you must keep the link "Design by Pikanai.com" live on the design. Enjoy!
                    </p>
                    <p>
                        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus non erat eu dui dignissim dictum. Integer iaculis nulla at nisl. Proin ut enim non ipsum varius laoreet. Integer feugiat, ante fringilla blandit convallis, leo sapien egestas velit, non condimentum nulla sem vitae risus. Mauris aliquam auctor quam. Sed ac enim. Donec mattis dui id ligula. Integer vel sem eget ante cursus tristique. Nullam vel orci vitae sem interdum placerat. In eget lectus. Donec blandit. Quisque lacus urna, malesuada vel, mollis sit amet, rutrum nec, est. Proin blandit ornare nibh. Duis et felis.
                    </p>
                    <blockquote>
                        There could be your favourite quote or slogan.
                    </blockquote>
                    <p>
                        Fusce euismod nisi at libero malesuada consectetuer. Proin laoreet, nunc quis hendrerit gravida, neque leo placerat sapien, et semper tortor leo et urna. Ut tincidunt posuere tortor. Sed tristique, odio at luctus facilisis, nulla quam rhoncus tortor, at congue lacus elit nec metus. Sed tempor sapien ut elit. Donec ac turpis feugiat nisi porta vehicula.
                    </p>
                </article>
                <article>
                    <h2>H2 SubTitle #2</h2>
                    <p>
                        Aenean eu lorem at odio placerat fringilla. Cras faucibus velit quis dui. Proin scelerisque orci nec arcu. Pellentesque cursus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam mattis iaculis purus. Curabitur velit. Vivamus et diam pharetra elit auctor molestie. Suspendisse potenti. Praesent enim. Vivamus at magna. Ut et dolor eu erat facilisis sollicitudin. Duis sed ante. Suspendisse lorem. Suspendisse mollis, dolor sit amet pellentesque sodales, diam risus adipiscing diam, vel ornare lorem pede ac ipsum.
                    </p>
                </article>
                <aside>
                    <h3>Main menu</h3>
                    <ul>
                        <li><a href="#">About me</a></li>
                        <li><a href="#">Contact me</a></li>
                    </ul>
                    <h3>Sub menu</h3>
                    <ul>
                        <li><a href="#">Pikanai</a></li>
                    </ul>
                    <h3>Friends</h3>
                    <ul>
                        <li><a href="#">OSWD</a></li>
                        <li><a href="#">Open designs</a></li>
                    </ul>
                </aside>
            </div>
            <footer>
                <p>
                    Copyright &copy; 2015 | <a href="#">Your Site</a> | Design by <a href="#">Pikanai.com</a>
                </p>
            </footer>
        </div>
    </body>
</html>

CSS:

body {
    background: -webkit-linear-gradient(#636363, #CBCBCB);
    font-family: "Trebuchet MS", Verdana, serif;
}

.wrap {
    width: 750px;
    margin: 0 auto;
}

header h1 {
    color: #A40008;
    font-size: 28px;
    float: left;
    margin: 20px 0 0 0;
}

header h2 {
    clear: left;
    float: right;
    color: #FFFFFF;
    font-size: 20px;
    margin: 0 0 20px 0;
}

.content {
    clear: both;
    overflow: auto;
    background: white;
    text-align: justify;
    padding: 15px 25px;
}

.content h2, h3 {
    color: #A40008;
    font-size: 18px;
}

blockquote {
    font-size: 12px;
    font-weight: bold;
    font-style: italic;
    text-align: center;
    margin: 20px;
}

article {
    width: 76%;
    float: left;
}

article p {
    margin-right: 30px;
}

aside {
    border-left: 1px solid #8C8484;
    overflow: hidden;
}

aside ul {
    padding-left: 30px;
}

aside h3 {
    padding-left: 10px;
}

aside li {
    list-style-type: circle;
}

article p {
    font-size: 12px;
}

aside a {
    font-size: 12px;
    font-weight: bold;
    color: #000000;
}

aside a:hover {
    color: #A40008;
}

li h3 {
    list-style: none;
}

footer {
    clear: both;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
}

footer a {
    color: #A40008;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

Hello Arnas Milaševičius,

I checked your template and I don't see any issues on my computer. Your markup looks good to me.

The gradient filled all my screen, there's no space at the bottom.

how do I move that h2 tag in the header to the left a little bit?. You can add margin-left: "value"; to the h2 tag.

If your recreating the template to practice your new skills. It's not going to look the same unless you copy the exact same html and css.

I recommend using classes instead of html tags. example: header h1 you can just add a class like so .main-heading.

<h2 class="main-heading">Content Here</h2>

This will target your elements faster.

Hope this helps.

This is the little grey space on the bottom of the page: http://i.imgur.com/V1tc6TE.png

Adding margin-left to the h2 didn't change anything.

And what about the navigation on the right side?

Like I said I don't see any issues on my computer.

Can you maybe put your code on an editable source code like codepen.io or jsfiddle.

I think it will be easier to help you out.

Sure, there you go: http://jsfiddle.net/L2L9xs9q/

There isn't any grey space either :(. So why do I see it on my computer? Did you see the pic?

So, I added min-height:100% to the html element so it will fill up the entire viewport and so your body element will expand.

http://jsfiddle.net/L2L9xs9q/

Uhm, I think you pasted the wrong link ^^. And btw you didn't answer my question about navigation bar and h2 element in the header :(.

And why did you use html elements instead of body?

Body element looks to its parent (HTML) for how to scale the dynamic property, so the HTML element needs to have it's height set.