If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Member #

    Question Looking for a better way to create a responsive header & nav

    I am trying to create a website header in HTML5 that has the navigation nested inside.

    Then I recently learned about responsive design and I am trying to see if I can create one that will shrink to fit the size of phones and tablets.

    How is my HTML and CSS? What can I improve? At its smallest size the logo will be placed on top with the navigation below it.

    I also noticed that when I shrink the browser window, the background of the header gets sliced in half.

    Here is the code:

    <!DOCTYPE html>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <title>navigation test</title>
        <style type="text/css">
    html, body, div, span, applet, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, font, img, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td, header, footer, section,
    aside, nav, article, figure, time, legend {
        margin: 0;
        padding: 0;
        border: 0;
        outline: 0;
        font-family:  arial, verdana, tahoma, helvetica;
        vertical-align: baseline;
    body {
        font-size: 0.750em;
        line-height: 1;
        background:#332f30 url(../images/backgrounds/mainbg.jpg) repeat bottom left;
    ol, ul {
        list-style: none;
    img, header, footer, section, aside, nav, article, figure, time, legend {
        /* --------------------- LINKS --------------------- */
    a {
    a:focus, a:hover {
    aside a, article a{
    /* --------------------- WRAPS --------------------- */
    header div {
            background-color: #444444;    
    header div:after {
         display: block;
        height: 0;
        clear: both;
    /* --------------------- HEAD --------------------- */
    header {
        background-color: #444444;
    header img.logos {
        float: left;
       margin-top: 30px;
    header ul {
        float: right;
        display: inline;
        height: 22px;
    header li {
        display: inline;
    header li a {
        height: 22px;
        margin-left: 32px;
        font-size: 20px;
        font-family: 'Century Gothic', Helvetica, sans-serif;
        font-weight: bold;
    <img src=" Version/images/logo.png" width="203" height="41" class="logos">
                    <li><a href="#" class="portfoliobtn" title="link to portfolio">HOME</a></li>
                    <li><a href="#" class="aboutbtn" title="link to about">ABOUT</a></li>
                    <li class="active"><a href="#" class="blogbtn" title="link to about">PORTFOLIO</a></li>
                    <li><a href="#" class="contactbtn" title="link to contact">CONTACT</a></li>
    Attached Images Attached Images
    Last edited by deffvaltez; Apr 10th, 2014 at 12:39 PM.


  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Not from USA
    Member #
    2784 times
    First off, if your background's a solid color, you don't really need a background image. That's a waste of resource.

    The reason your header is getting cut off is probably because you have it sized to 946px. If you want, use a relative width such as 100% to deal with that issue. At least if I'm interpreting what you said correctly, that should solve it.

    The biggest thing you can improve on your CSS is not to use that flaming car wreck known as the Eric Meyer CSS reset. I don't know why he ever came up with that thing, but people need to stop using it because it's flawed right out of the chute. If you're not sure what I mean, put nothing other than an ordered list on your page and you should see it.

    Once you get those things done, then all you need to do is to add some media queries in and you should be set.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Tags for this Thread

All times are GMT -6. The time now is 09:58 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: