Web Design Forum  
 
Go Back   Web Design Forum > Web and Graphic Design > Web Design

Reply
 
LinkBack Thread Tools Display Modes
Old 03-11-2010, 10:11 PM   #1
New Member
 
Join Date: Feb 2010
Posts: 4
Question CSS Sprite Position and Menu LI width

Hi,

I'm applying css sprites to my custom html menu. I'm unable to figure out how to position the sprite above the content of the line item, without losing visibility of the image. When I apply a background position of 0 -25px, the image locates above the content, however the image does not display properly.

I have a sprite that is 80px wide, with 2 images inside it, each 40px wide. When I set the width of line item to 40px, the menu item's content does not have enough width, and squeezes together.

How should I display the image on top of the menu content?

How can I display only 40px of the sprite, while the menu item has a width of about 55px, so the content of the menu item displays correctly?

My site is at http://www.infinitesolutionsonline.com

Thank you very much!

Ty
fAdEd247 is offline   Reply With Quote


Old 03-12-2010, 04:55 AM   #2
Silver Member
 
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 108
Default

margin-bottom:-100px;
__________________
Nerdrage
Mezangath Web
mezangath is offline   Reply With Quote
Old 03-12-2010, 03:49 PM   #3
Super Moderator
 
Join Date: Oct 2008
Location: Arizona, USA
Posts: 1,050
Default

Ty,

if you want the icons/images in the sprite to be above the anchor text in the LIs, why not increase the height of the LIs and then position the sprite above them? You can vertically align the text in the LI by using "line-height:"

Make sense?
__________________
John Darling
Graphic / Web Designer
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
PixelPusher is offline   Reply With Quote
Old 03-13-2010, 10:12 PM   #4
New Member
 
Join Date: Feb 2010
Posts: 4
Default

Hi,

Thanks for the replies.

When I increase #mymenu li height, the submenu's increase in distance. When I increase the height of the anchor class, nothing changes visually. This is with the background position at 0 -30px

When I increase the line height in pixels, the menu content lowers, however the menu content begins to become very distant with higher height settings.

After more research, I've realized is best to compile all of the images into a single file, which is what I have now done.

For fun, I've left the first menu item as the previous sprite.

Thanks for your help.

Ty
fAdEd247 is offline   Reply With Quote
Old 03-16-2010, 05:39 PM   #5
Super Moderator
 
Join Date: Oct 2008
Location: Arizona, USA
Posts: 1,050
Default

So it sounds like you fixed the problem? If so, good job and you are welcome.
__________________
John Darling
Graphic / Web Designer
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
PixelPusher is offline   Reply With Quote


Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:24 PM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.