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 3 of 3
  1. #1
    Junior Member
    Join Date
    Jun 2012
    Member #
    Hey all!

    I am starting to learn how sprites work and how to code them.
    I have a sprite that is so far displaying working, but can someone please guide me on how to get the navigation with all the list items inside it to sit all the way to the left so that I can eliminate the green space that's seen on the left.....there seems to be some margin or padding to the left of the li elements.
    Do I need to target the div or the li elements inside it to fix this issue?

    Here is a screen shot of the problem:

    Uploaded with

    -----------------------------------------------Here is the HTML

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link rel="stylesheet" type="text/css" href="css/styles.css" />
    <div id="navigation">
            <li id="home"><a href="#">Home</a></li>
            <li id="audio"><a href="#">Audio</a></li>
            <li id="games"><a href="#">Games</a></li>
            <li id="international"><a href="#">International</a></li>
            <li id="search"><a href="#">Search</a></li>
            <li id="contact"><a href="#">Contact</a><!--end navigation div--></li>

    ---------------------------------Here is the CSS

    @charset "utf-8";
    /* CSS Document */
    body {
    background-color: #F3F3F3;
    font: 12px Arial, Helvetica, sans-serif;}
    #navigation  {
    margin: auto;
    width: 960px;
    height: 85px;
    ul li {
    margin-right: 20px;
    float: left;
    background-color: #FCF;
    list-style: none;
    background-image: url(../images/spriteset2small.png);
    width: 85px;
    height: 85px;
    ul li a {
    float: left;
    width: 85px;
    height: 85px;
    display: block;
    line-height: 145px;
    text-decoration: none;
    #home {
    background-position: 0 0;}
    #audio {
    background-position: 0 -85px;}
    #games {background-position: 0 -170px;}
    #international {background-position: 0 -255px;}
    #search{background-position: 0 -340px; }
    #contact {background-position: 0 -425px;}

    Thank you for taking your time out to help![/CODE][/FONT]


  3. #2
    Join Date
    Jun 2012
    Member #
    3 times
    First off, you defined #navigation margins to be auto instead of 0.

    You did not define the default margin for the <ul> to be 0
    or the margin-left for the <li> to be 0

    Do not leave any tag in your code undefined or browser defaults kick in.

    That is what a CSS Reset is for...
    TheGAME1264 likes this.

  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Not from USA
    Member #
    2784 times
    You'll also want to define the padding as well as the margin. Both can contribute to this specific problem, but it's hard to say which one:
    ul {margin:  0;  padding: 0;}
    li {margin: 0;  padding:  0;}
    This will get rid of any padding and margins and it SHOULD at least get rid of the left space. From there, you can adjust to get the right spacing back the way you want it.
    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
All times are GMT -6. The time now is 08:16 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: