- This topic is empty.
-
AuthorPosts
-
October 5, 2010 at 10:39 am #30448NicoleMember
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.
October 5, 2010 at 11:37 am #78771kevsyersParticipantMaybe 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
October 6, 2010 at 10:54 am #78804kylewiedmanMemberkevsyers is right it should be
background-image:url('images/stars/five.png');
October 6, 2010 at 11:24 am #78806BobMemberYeah 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.October 7, 2010 at 1:09 pm #78463zackwMemberbob u can even go 1 step further and write
background: #fff url('../images/header.jpg') no-repeat;
3 less f’s :) hah
October 7, 2010 at 1:24 pm #78466TheDocMemberTo 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;
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.