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

Website is a mess after resizing the browser.

<!DOCTYPE html>
<html>
    <title>
        <title>Cya Computer Company</title>
        <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" href="style.css">
    </title>
    <body>
        <header id="wrapper">
            <nav>
                <ul>
                    <li><a href="index.html">Home</a></li>
                    <li><a href="services.html">Services</a></li>
                    <li><a href="history.html">Our History</a></li>
                    <li><a href="contact.html">Contact Us</a></li>
                </ul>
            </nav>
            <div class="logo">
                <h1>Cya Computer Computer</h1>
                <h2>We Make Your Computer Problems Disappear</h2>
            </div>
        </header>
        <content>
    </body>
<html>

```css

body {
    background-image: url("r1.jpg");
    background-color: #fff
}
#wrapper {
    text-align: center;
}

nav li {
    list-style-type: none;
    display: inline;
    padding: 6px 50px;
    background-color: black
}
a {
    text-decoration: none;
    color: white;
}

h1 {
    font-size: 85px;
    text-transform: uppercase;
    color: white;
}
h2 {
    font-size: 45px;
    text-transform: uppercase;
    color: white;
}

use media queries for adjusting your websites

2 Answers

Adam Hill
Adam Hill
7,492 Points

As Ashish mentioned, you need to decide how you want your site to look at different size and adjust your css with media queries.

You have a couple of tags out of place in your html too, which won't help on older browsers.

<!DOCTYPE html>
<html>
    <head>
        <title>Cya Computer Company</title>
        <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <body>
        <header id="wrapper">
            <nav>
                <ul>
                    <li><a href="index.html">Home</a></li>
                    <li><a href="services.html">Services</a></li>
                    <li><a href="history.html">Our History</a></li>
                    <li><a href="contact.html">Contact Us</a></li>
                </ul>
            </nav>
            <div class="logo">
                <h1>Cya Computer Computer</h1>
                <h2>We Make Your Computer Problems Disappear</h2>
            </div>
        </header>
        <content></content>
    </body>
<html>
body {
    background-image: url("r1.jpg");
    background-color: #fff
}
#wrapper {
    text-align: center;
}

nav li {
    list-style-type: none;
    display: inline;
    padding: 6px 50px;
    background-color: black
}
a {
    text-decoration: none;
    color: white;
}

h1 {
    font-size: 85px;
    text-transform: uppercase;
    color: white;
}
h2 {
    font-size: 45px;
    text-transform: uppercase;
    color: white;
}

@media all and (max-width: 768px) {

    nav li {
        padding: 6px 30px;
    }

    h1 {
        font-size: 65px;
    }
    h2 {
        font-size: 35px;
    }

}
Travis Lima
Travis Lima
15,877 Points

Hey Siavash,

Media queries are going to help you with this. Basically a media query will allow your site to "Respond" according to the screen size it is being viewed on. It also helps to have a "mobile first" approach when designing any website. Nick Pettit has a great tutorial from start to finish on this exact topic. Here is a link for more info https://teamtreehouse.com/library/how-to-make-a-website