Hi folks,

I'm currently taking a Udemy course in HTML & CSS and there's what looks like a simple query wrecking my head.

I'm trying to float my section to the right and keep 'aside' on the left.

This is what the webpage should look like https://www.dropbox.com/s/7jb9kbss58u0bxd/UDEMY.png?dl=0

I'd be super grateful if anyone could tell me where I'm going wrong.

CSS

/* http://meyerweb.com/eric/tools/css/reset/ 
       v2.0 | 20110126
       License: none (public domain)
    */

    html, body, div, span, applet, object, iframe,
    p, blockquote, pre, h1,h2,h3,h4,h5,h6, p
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, img, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    b, u, i, center,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, embed, 
    figure, figcaption, footer, header, hgroup, 
    menu, nav, output, ruby, section, summary,
    time, mark, audio, video {
        margin: 0;
        padding: 0;
        border: 0;
        font-size: 100%;
        font: inherit;
        vertical-align: baseline;
    }

    /*=======================================*/

    /* Author: Sandy - sandyludosky.github.io
         Date: 2014/09/15

       - Learn to code a sleek website with HTML & CSS - 
    */



    h1,h2,h3,h4,h5,h6 {
        color: #2c3e50;

    }

    .container {

    }

    /* header section */
    header {
        background: #2c3e50;
        color: white;


    }

        header h1 {
    color: #95a5a6;
    font-size: 20px;
        }

    /* nav section */

    nav {
        background: #95a5a6;

    }

        nav ul {
            /*float: right;*/

            }

        nav ul li {
        font-size: 18px;
        display: inline-block;
        border-right: 1px solid white;


        }

            nav li:hover {
                background: blue;

            nav li:nth-child(even) a {
            color: red;
        }

        nav li a  {
            color: #fff;
            text-decoration: none;

        }

    section#main {
    width: 55%;
    float: right;
    }


    #aside {
    width: 26%;
    float: left; 

    }

        aside h3 {}

    footer {
        background: #2c3e50;
        text-align: left;
        position:absolute;
        bottom: 0;
        width: 100%;
        bottom: 0;
    }

    main { 
     text-align: right;
     }
    .text-center {
        text-align:center;
    }


    @media only screen and (min-width : 768px) and (orientation : landscape) {
    /*Style*/

    }

    /* iPads (Tablets) ----------- */
    @media only screen and (min-width: 768px) and (max-width : 1024px){
    /* Style */
    }

    /*for small devices (landscape & portrait) */
    @media only screen and (min-width : 320px) and (max-width: 767px) {
    /* Styles */

HTML

<!doctype html> 
<html>
<head>
    <title>Site Name</title>
    <meta name='author' content='[your name]'>
    <meta name='description' content=''>
<link rel="stylesheet" type="text/css" href="style.css">

    <!-- add a favicon -->

    <style type="text/css">
    h1, h2, h3, h4, h5, h6 {
        font-family: Helvetica, Arial, sans-serif;
    }
    }
    header h1 { font-size: 48px;
        } type="text/css">
    nav ul { 
        font-size: 18px; }

    </style>

</head>

<body>

<div class='container'>

        <header>
        <h1>Site name</h1>
        </header>

        <nav>
        <ul class='text-center'>
            <li><a href="http://www.w3schools.com/html/" target="_blank">Home</a> </li>
            <li><a href="http://www.w3schools.com/html/" target="_blank">About</a> </li>
            <li><a href="http://www.w3schools.com/html/" target="_blank">Servies</a> </li>
            <li><a href="http://www.w3schools.com/html/" target="_blank">Contact Us</a> </li>
            <li><a href="http://www.w3schools.com/html/" target="_blank">Visit our HTML tutorial!</a> </li>
        </ul>
        </nav>

</div>
<div id="content-container">

  <section id="main">
    <nav>Content for New nav Tag Goes Here</nav>
            <h2>Page heading</h2>
            <p>
                <strong>Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh euismod tinunt ut laoreet dolore magna aliquam erat volut. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. </strong>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. 
            </p>

            <p>
                <strong> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat </strong>. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. 
            </p>
            <p>
                <strong>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</strong> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. 
            </p>
            </section>       

<br>

                <Aside>
                <h3><em>Aside heading</em></h3>
                <p> Duis autem vel eum iriure dolor in <strong>hendrerit </strong>in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan.</p>
                <br><hr><br>   

                <h3><em>Aside heading</em></h3>
                <p> Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan.</p>

                <br><hr><br>   

                <h3><em>Aside heading</em></h3>
                <p> Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan.</p>

            </aside>
                <nav>Content for New nav Tag Goes Here</nav>
            </div>   

<div>


        <footer class='text-center'>
            Copyright © Site name, 2014
        </footer>

</div>

</body>
</html>
    }

Recommended Answers

All 2 Replies

There are few errors in the CSS, first at line 17 of the HTML page fix this:

header h1 { font-size: 48px;
    } type="text/css">

By removing type="text/css">. Then inside the css file at line 79:

nav li:hover {
    background: blue;

nav li:nth-child(even) a {
    color: red;
}

You are not closing the brackets:

nav li:hover {
    background: blue;
}

nav li:nth-child(even) a {
    color: red;
}

At the end of the file it's missing another closing bracket:

@media only screen and (min-width : 320px) and (max-width: 767px) {
/* Styles */

When in doubt you can use the CSS validator:

Cereal - Thank you so much. That's been wrecking my head for ages.

Look forward to contining the course.

Cheers,

Niall

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.