0

I've got the beginnings of a website, with the header and navigation bar already implemented. I also have a main section implemented, but only in absolute positioning. I've tried many things, but how would I go about positioning it relatively? Every time I try, the section and the header get all mixed in with each other. I want the section to display in the middle. Here's my HTML...:

<!DOCTYPE html>

<html>
    <head>
        <title>B by Bruno | A friendly corporation</title>

        <link href="styles.css" rel="stylesheet" type="text/css">
    </head>

    <body>
        <header>
            <a href="#">
                <h1>B by Bruno</h1>
                <h6>A friendly corporation<span id="point">.</span></h6>
            </a>
        </header>

        <nav>
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">About Us</a></li>
                <li><a href="#">Contact Us</a></li>
                <li><a href="#">The Team</a></li>
            </ul>
        </nav>

        <section>
            <h2>BIENVENU</h2>
            <p>Voici le site de notre compagnie cr&eacute;&eacute;e entre amis!</p>
        </section>
    </body>
</html>

...and my CSS:

@import url(http://fonts.googleapis.com/css?family=Nobile:400,700italic);

body {
    background-color: #222222;
    background-image: url("bg.png");
    color: #D8D8D8;
    font-family: "Nobile", sans-serif;
}

a {
    color: #D8D8D8;
    text-decoration: none;
}

header {
    float: left;
    font-style: italic;
    font-weight: 700;
    line-height: 50%;
    margin: 1em;
    text-align: center;
    width: 15em;
}

header a {
    display: block;
}

header a h1 {
    text-decoration: underline;
    -moz-text-decoration-color: red;
}

#point {
    color: red;
}

nav {
    float: left;
}

nav ul {
    background-image: -moz-linear-gradient(top, #ff0000, #8f0000);
    background-image: linear-gradient(top, #ff0000, #8f0000);
    border-radius: 0.5em;
    height: 3em;
    list-style-type: none;
    margin: 2em 0 0 1em;
    width: 60em;
}

nav ul li {
    display: block;
    float: left;
    height: 3em;
    margin: 0;
    position: relative;
    padding: 0 2.5em;
    text-align: center;
    text-shadow: 1px 1px 1px #000000;
}

nav ul li:hover {
    background-image: -moz-linear-gradient(top, #121212, #222222);
    background-image: linear-gradient(top, #121212, #222222);
}

nav ul li a {
    display: block;
    height: 2em;
    padding: 1em 0 0;
}

section {
    margin: 15em 10em;
    position: absolute;
    width: 95%;
}

section h2 {
    font-style: italic;
    font-weight: 700;
}

What exactly would I have to change, add, or remove?

3
Contributors
2
Replies
13
Views
3 Years
Discussion Span
Last Post by Taywin
0

I am not sure those tag names are recognized by older browser (especially IE). Also, the default display behavior of custom tags would be similar to <span>, so you may need to specify the display as block in your CSS...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.