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

HTML

I want to put my "maintext" text underneath the "navbar" how do I do that?

I've tried to put "mainText" in "navBar" itself and as a result I can't view the text in the webpage. I can only see the contents in my navBar but the text is hidden somehow.

This is my HTML.

<!DOCTYPE html>

<html>
    <head>
        <title>Testing2</title>

        <link rel="stylesheet" href="H:\DucksWillRuleTheWorld\nillinee-verhuur VSC\Testing 2\Testing2.css"
    </head>

    <body>
        <div class="navbar">
            <div class="container">

                <div class="logo_div">
                    <img src="https://nillinee.nl/wp-content/uploads/2020/07/cropped-Afbeelding2-7.png" alt="logo" class="logo"
                </div>

                <div class="navbar_links">
                    <ul class="menu">
                        <li><a href="#Home">Home</a></li>
                        <li><a href="#Producten">Producten</a></li>
                        <li><a href="#Huren">Huren</a></li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="maintext"> <!-- I can't see all the contents here. I think the problem must be here somewhere -->
            <h1>Heading 1</h1>
                <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nulla, tenetur at. Obcaecati ex excepturi quae iure harum deleniti, nulla id?</p>
            <h2> Heading 2</h2>
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Iste magnam recusandae eaque dolores corporis dolor adipisci rerum voluptatibus. Distinctio, totam.</p>
        </div>

    </body>

    <footer>
        <h1>Heading 1</h1>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi, praesentium.</p>
    </footer>
</html>

This is my CSS

* {
    margin: 0;
    padding: 0;
}

.navbar{
    width: 100%;
    overflow: hidden;
    height: 70px;
    line-height: 70px;
    background: #fff4ff;
    border-bottom: 2px solid black;
}

.logo {
    width: 85px;
    float: left;
}

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

.menu {
    float: right;
}

.menu li {
    float: left;
    width: 120px;
    height: 70px;
    line-height: 70px;
    text-align: center;
    list-style: none;
}

.menu li a {
    color: black;
    text-decoration: none;
    text-transform: uppercase;
    display: block;
}

.menu li:hover{
    background: #b07a7a;
}

.menu li a:hover{
    color: #fff4ff;
}

2 Answers

Nikos Papapetrou
Nikos Papapetrou
6,305 Points

You forgot to close the tags in the img and link tag. That might cause you an error.

<!DOCTYPE html>

<html>
    <head>
        <title>Testing2</title>

        <link rel="stylesheet" href="H:\DucksWillRuleTheWorld\nillinee-verhuur VSC\Testing 2\Testing2.css"> <!-- close your tag -->
    </head>

    <body>
        <div class="navbar">
            <div class="container">

                <div class="logo_div">
                    <img src="https://nillinee.nl/wp-content/uploads/2020/07/cropped-Afbeelding2-7.png" alt="logo" class="logo"> <!-- close your tag -->
                </div>

                <div class="navbar_links">
                    <ul class="menu">
                        <li><a href="#Home">Home</a></li>
                        <li><a href="#Producten">Producten</a></li>
                        <li><a href="#Huren">Huren</a></li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="maintext"> <!-- I can't see all the contents here. I think the problem must be here somewhere -->
            <h1>Heading 1</h1>
                <p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nulla, tenetur at. Obcaecati ex excepturi quae iure harum deleniti, nulla id?</p>
            <h2> Heading 2</h2>
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Iste magnam recusandae eaque dolores corporis dolor adipisci rerum voluptatibus. Distinctio, totam.</p>
        </div>

    </body>

    <footer>
        <h1>Heading 1</h1>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi, praesentium.</p>
    </footer>
</html>

Nikos Papapetrou Thanks a bunch ^-^! My friend is very grateful and he also feels very stupid 😅

Nikos Papapetrou
Nikos Papapetrou
6,305 Points

No problem. I am glad I helped your friend.