Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Need Another Set of Eyes on a Silly CSS Background Issue

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #30448
    Nicole
    Member

    This is probably a stupid question and is simply a case of me needing a fresh set of eyes to see an obvious mistake, but I’m stuck.

    I’m using an unordered list to display my skill set for a new portfolio site I’m building. I want to use background images to display a star rating of my skill level with each program/language. This is the HTML in question (the list is longer, obviously, but I’ve chopped it down to one LI to show the concept):





    And this is the CSS:



    .skills li{
    display:block;
    width:178px;
    height:21px;
    }

    .skills a{
    color:#6d7374;}

    .skills a:hover{
    text-decoration:none;
    }

    .five{
    background-image:images/stars/five.png;
    display:block;
    width:178px;
    height:11px;
    padding:5px 0px 5px 0px;
    }

    .even{
    background:#f3f3f3;
    border-top:1px solid #f0e9e7;
    border-bottom:1px solid #f0e9e7;
    width:178px;
    height:21px;
    }

    The .even class is applied to the list item and is assigned to ever other item in the list to achieve an alternating background color. Inside each list item is a link that is assigned a class based on how many stars it would have, and the class for the number of stars (.five, in this case) has the appropriate background image.

    It seems no matter what I do, the background image doesn’t show up. And yes, the path to the image is correct.

    #78771
    kevsyers
    Participant

    Maybe I’m wrong but shouldn’t it be written like this?

    background-image: url(‘paper.gif’);

    I always just write

    background: url(‘x.jpg’);

    to each his/her own i guess

    #78804
    kylewiedman
    Member

    kevsyers is right it should be

       background-image:url('images/stars/five.png');
    #78806
    Bob
    Member

    Yeah the way virtual wrote it, you can have both a background color and an image, like this:

    background: #FFFFFF url('../images/header.jpg') no-repeat;

    That way, the image would just be displayed once (no-repeat) and the white color (#FFFFFF) on the rest of the background.

    #78463
    zackw
    Member

    bob u can even go 1 step further and write


    background: #fff url('../images/header.jpg') no-repeat;

    3 less f’s :) hah

    #78466
    TheDoc
    Member

    To add ONE more into this conversation… I usually go like this:

    background: url(path/to/image.jpg) no-repeat #fff;

    And if I needed positioning:

    background: url(path/to/image.jpg) top center no-repeat #fff;
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.