Old 18-02-2008, 18:02   #1 (permalink)
apple
Registered User
 
apple's Avatar
 
Join Date: Jan 2008
Location: Scotland
Posts: 32
Send a message via MSN to apple
Background Images in List

How do i set background images for li tags in css ? This is what i have so far but background images aren't appearing full size.
This is how it appears:

Code :

HTML Code:
<div id="navigation"> <ul> <li><a href="#">home</a></li> <li><a href="#">terms of service</a></li> <li><a href="#">contact</a></li> </ul> </div>

Code:
ul { list-style-type:none; padding:0; margin:0; } li { list-style-type:none; padding:0; margin:0; } #navigation { height:41px; width:728px; } #navigation ul { list-style: none; margin-left:500px; } #navigation li { display:inline; background:url(images/button.png) no-repeat; margin-right:10px; } #navigation a { padding-top:10px; }
  Reply With Quote
Old 18-02-2008, 18:38   #2 (permalink)
Shiro
shiro
 
Shiro's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,621
They may not be visible because you don't have enough padding for them to be seen. Try adding some padding/margins to the right and left edges of those to see if the images appear, and if they do, work backwards from there to clean up your code.
  Reply With Quote
Old 19-02-2008, 17:39   #3 (permalink)
apple
Registered User
 
apple's Avatar
 
Join Date: Jan 2008
Location: Scotland
Posts: 32
Send a message via MSN to apple
where exaclty should i be using padding ?
  Reply With Quote
Old 19-02-2008, 17:46   #4 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
What's button.png look like?
  Reply With Quote
Old 20-02-2008, 18:40   #5 (permalink)
apple
Registered User
 
apple's Avatar
 
Join Date: Jan 2008
Location: Scotland
Posts: 32
Send a message via MSN to apple


like that ^
  Reply With Quote
Old 29-02-2008, 13:08   #6 (permalink)
apple
Registered User
 
apple's Avatar
 
Join Date: Jan 2008
Location: Scotland
Posts: 32
Send a message via MSN to apple
anyone ?
  Reply With Quote
Old 01-03-2008, 07:53   #7 (permalink)
chaos.dave
"Everybody's Dead Dave"
 
chaos.dave's Avatar
 
Join Date: Dec 2007
Location: Loughborough, UK
Posts: 131
try declaring a height and width for the li tags in your CSS.

Example:

Code:
list-style-type:none; padding:0; margin:0; height:30px; width:60px;

obviously change the values to match the needs of your background images.
  Reply With Quote
Old 01-03-2008, 08:28   #8 (permalink)
bazzle
Senior Member
 
bazzle's Avatar
 
Join Date: Aug 2007
Location: Derby uk
Posts: 584
Send a message via MSN to bazzle
As far as I know, you can't set a background image for an inline element.

You need to add display:block; to #navigation li and set a width and height.

Then you have to add float left to position them side by side.
  Reply With Quote
Old 01-03-2008, 08:43   #9 (permalink)
bazzle
Senior Member
 
bazzle's Avatar
 
Join Date: Aug 2007
Location: Derby uk
Posts: 584
Send a message via MSN to bazzle
Plus you must have linked your background image incorrectly as it should show up straight away.
  Reply With Quote
Old 01-03-2008, 11:25   #10 (permalink)
safe as milk
Senior Member
 
safe as milk's Avatar
 
Join Date: Feb 2008
Posts: 151
i'm fairly new to this but could you not make the your anchor's display as block elements, give them a height and width then put the image in as a background?
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8