Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

100% width nav problem

Featured Replies

I know there are a lot of 100% width posts but I can't seem to get an answer to my problem.

 

The site i'm working on is located here:

http://edgar.ldn.kualo.net/~lmpmeuk/web/busybees/

 

I want the navigation bar and footer bar at the bottom to span the whole width. As you will notice there is a slight spacing left and right of each to those bars.

 

 

    <header>
            <div class="container clearfix">
                <a href="/" title="Click here to go home" id="logo">
                <img src="img/logo-main.png" alt="logo">
                </a>
            </div>


                <nav>
                    <ul>
                        <li><a href="/about">About</a></li>
                        <li><a href="/products-and-prices">Products and Prices</a></li>
                        <li><a href="/gallery">Gallery</a></li>
                        <li><a href="/contact">Contact me</a></li>
                    </ul>
                </nav>
            
            <div class="container clearfix center-align">
            
                    <div id="hero-image">
                                    <a href="/">
                <img src="img/slider/kitchen_adventurer_cheesecake_brownie.jpg" alt="hero">
                </a>
                    </div>
            
            </div> <!--end hero container-->
        </header>
 

 

CSS:

 

 

footer {
    color: #333;
    background: #fdffac;
}


/* NAVIGATION */


nav {
    background: #ff7070;
}


nav ul {
    text-align: center;
    padding: 10px 20px 10px;
}


nav ul li {
    list-style: none;
    display: inline;
}


header nav ul li a {
    display: inline;
    color: #fff;
    text-decoration: none;
    font-weight: 400;
    padding: 20px;
}


header nav ul li a:hover {
    background: #ff7070;
    border-radius: 8px;
    font-weight:bold;


}


header nav ul li a:active {
    -webkit-box-shadow: 0 0 5px rgba(0,0,0,0. inset;
    -moz-box-shadow: 0 0 5px rgba(0,0,0,0. inset;
    box-shadow: 0 0 5px rgba(0,0,0,0. inset;
}
 

 

 

If you give your body a margin:0; the nav takes ful width.

However, it is better to use a reset CSS for consistency across different browsers, here is a good one - http://meyerweb.com/eric/tools/css/reset/

Another thing is to give all element default margin and padding 0, like this

 

 

*{
    margin:0;
    padding:0;
}
 

Hope that helps :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.