The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Implementing CSS sprites

View previous topic View next topic Go down

Implementing CSS sprites

Post by coco moco on July 18th 2011, 11:08 am

I'm redoing my buttons and I want to use CSS sprites so I don't have a gazillion server requests. I'm having some interesting problems with it.

The first thing I tried was swapping over my navbar, it's currently:

Spoiler:
Code:
#i_icon_mini_index {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/homebu10.gif");
width: 72px;
height: 35px;
}
#i_icon_mini_index:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/homebu11.gif");
width: 72px;
height: 35px;
}
#i_icon_mini_profile {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/profil10.gif");
width: 76px;
height: 35px;
}
#i_icon_mini_profile:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/profil11.gif");
width: 76px;
height: 35px;
}

#i_icon_mini_message {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/messag10.gif");
width: 103px;
height: 35px;
}
#i_icon_mini_message:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/messag11.gif");
width: 103px;
height: 35px;
}
#i_icon_mini_new_message {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/newmes10.gif");
width: 137px;
height: 35px;
}
#i_icon_mini_new_message:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/newmes11.gif");
width: 137px;
height: 35px;
}
#i_icon_mini_logout {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/logout10.gif");
width: 81px;
height: 35px;
}
#i_icon_mini_logout:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/logout11.gif");
width: 81px;
height: 35px;
}
#i_icon_mini_login {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/loginb10.gif");
width: 66px;
height: 35px;
}
#i_icon_mini_login:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/loginb11.gif");
width: 66px;
height: 35px;
}
#i_icon_mini_register {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/regist10.gif");
width: 89px;
height: 35px;
}
#i_icon_mini_register:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/regist11.gif");
width: 89px;
height: 35px;
}
#i_icon_mini_faq {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/faqbut10.gif");
width: 52px;
height: 35px;
}
#i_icon_mini_faq:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/faqbut11.gif");
width: 52px;
height: 35px;
}
#i_icon_mini_search {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/search10.gif");
width: 79px;
height: 35px;
}
#i_icon_mini_search:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/search11.gif");
width: 79px;
height: 35px;
}
#i_icon_mini_groups {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/groups10.gif");
width: 119px;
height: 35px;
}
#i_icon_mini_groups:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/groups11.gif");
width: 119px;
height: 35px;
}
#i_icon_mini_members {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/member10.gif");
width: 117px;
height: 35px;
}
#i_icon_mini_members:hover {
background-image: url("http://i40.servimg.com/u/f40/16/60/24/51/member11.gif");
width: 117px;
height: 35px;
}

Even though the sprite classes exist for these buttons, they won't display. My sprite image, and sizes are all correct, but they don't seem to be being loaded. I've also tried using a variation of my original navbar classes, as it works for the separate images, even if the sprite classes aren't removed. It also doesn't work.

Furthermore, if I turn off the basic CSS then the
Spoiler:
Code:
.sprite-arrow_prosilver_down{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:0 0;
   width:6px;
   height:6px;
   }
.sprite-arrow_prosilver_left{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-56px 0;
   width:4px;
   height:6px;
   }
.sprite-arrow_prosilver_right{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-110px 0;
   width:4px;
   height:6px;
   }
.sprite-arrow_prosilver_up{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-164px 0;
   width:6px;
   height:6px;
   }
.sprite-arrow_subsilver_down{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-220px 0;
   width:9px;
   height:9px;
   }
.sprite-arrow_subsilver_left{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-279px 0;
   width:9px;
   height:9px;
   }
.sprite-arrow_subsilver_right{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-338px 0;
   width:9px;
   height:9px;
   }
.sprite-arrow_subsilver_up{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-397px 0;
   width:9px;
   height:9px;
   }
.sprite-icon_minipost{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-456px 0;
   width:12px;
   height:9px;
   }
.sprite-icon_minipost_new{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-518px 0;
   width:12px;
   height:9px;
   }
.sprite-icon_minipost_participate{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-580px 0;
   width:12px;
   height:9px;
   }
.sprite-icon_miniposted{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-642px 0;
   width:12px;
   height:9px;
   }
.sprite-icon_pages{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-704px 0;
   width:11px;
   height:12px;
   }
.sprite-icon_post_target{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-765px 0;
   width:11px;
   height:9px;
   }
.sprite-icon_post_target_unread{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-826px 0;
   width:11px;
   height:9px;
   }
.sprite-icon_reply{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-887px 0;
   width:18px;
   height:9px;
   }
.sprite-icon_reply_new{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-955px 0;
   width:18px;
   height:9px;
   }
.sprite-icon_tiny_topic{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-1023px 0;
   width:10px;
   height:11px;
   }
.sprite-icon_topic_latest{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-1083px 0;
   width:11px;
   height:9px;
   }
.sprite-icon_topic_newest{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-1144px 0;
   width:11px;
   height:9px;
   }
.sprite-subforum_read{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-1205px 0;
   width:11px;
   height:9px;
   }
.sprite-subforum_unread{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-1266px 0;
   width:11px;
   height:9px;
   }
.sprite-tabs_less{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-1327px 0;
   width:9px;
   height:9px;
   }
.sprite-tabs_more{
   background:url("http://illiweb.com/fa/sprite_icons.png") no-repeat top left;
   background-position:-1386px 0;
   width:9px;
   height:9px;
   }
no longer works, even though it is specified in my CSS.

I'm probably missing something really basic Embarassed I would really love some help to get it resolved.

To sum up:

I'm on phpbb3,
Can't get sprites to work,
If I turn off the basic CSS, the sprites that were working will no longer work, even though they are specified in my CSS.

With rollover over effects, there are likely going to be around 100 images, which will really slow things up if I can't get sprites working Sad

EDIT: I've got the CSS sprite to work for my navbar
Spoiler:
Code:
#i_icon_mini_faq {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 52px;
    background-position  : -0px -0px;
 }
 
 #i_icon_mini_faq:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 52px;
    background-position  : -52px -0px;
 }
 
 #i_icon_mini_groups {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 119px;
    background-position  : -104px -0px;
 }
 
 #i_icon_mini_groups:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 119px;
    background-position  : -223px -0px;
 }
 
 #i_icon_mini_index {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 72px;
    background-position  : -342px -0px;
 }
 
 #i_icon_mini_index:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 72px;
    background-position  : -414px -0px;
 }
 
 #i_icon_mini_login {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 66px;
    background-position  : -486px -0px;
 }
 
 #i_icon_mini_login:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 66px;
    background-position  : -552px -0px;
 }
 
 #i_icon_mini_logout {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 81px;
    background-position  : -618px -0px;
 }
 
 #i_icon_mini_logout:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 81px;
    background-position  : -699px -0px;
 }
 
 #i_icon_mini_members {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 117px;
    background-position  : -780px -0px;
 }
 
 #i_icon_mini_members:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 117px;
    background-position  : -897px -0px;
 }
 
 #i_icon_mini_message {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 103px;
    background-position  : -1014px -0px;
 }
 
 #i_icon_mini_message:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 103px;
    background-position  : -1117px -0px;
 }
 
 #i_icon_mini_new_message {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 137px;
    background-position  : -1220px -0px;
 }
 
 #i_icon_mini_new_message:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 137px;
    background-position  : -1357px -0px;
 }
 
 #i_icon_mini_profile {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 76px;
    background-position  : -1494px -0px;
 }
 
 #i_icon_mini_profile:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 76px;
    background-position  : -1570px -0px;
 }
 
 #i_icon_mini_register {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 89px;
    background-position  : -1646px -0px;
 }
 
 #i_icon_mini_register:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 89px;
    background-position  : -1735px -0px;
 }
 
 #i_icon_mini_search {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 79px;
    background-position  : -1824px -0px;
 }
 
 #i_icon_mini_search:hover {
    background-image    : url("http://i40.servimg.com/u/f40/16/60/24/51/navbar11.gif");
    height              : 35px;
    width                : 79px;
    background-position  : -1903px -0px;
 }

It seems the problem was the styling of the background (the no-repeat stuff I had), and that the sprite IDs don't do anything, but the ones I've used do.

Next big problem, is I can't switch off the basic CSS and have the sprite for the the tiny buttons (some I would like to keep) and I've also noticed the "share" icons go bye byes as well.

It is specified in my CSS, so I don't understand why I lose it, furthermore what on earth am I meant to use as an ID for the buttons, if the code that was working, no longer works.

Any help greatly appreciated on this Smile

coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

Re: Implementing CSS sprites

Post by kirk on July 19th 2011, 3:22 am

what software are you using to create them?


here thsi if this helps, there is a lot of different ways to create them.

Googled Sprites

kirk
Forumaster

Male Posts : 11037
Reputation : 651
Language : English,Vulcan,Klingon, Romulan,& Gorn

Back to top Go down

Re: Implementing CSS sprites

Post by coco moco on July 19th 2011, 7:01 am

I really just use GIMP, and sometimes, if I have a stack of images I'll use on an online generator. The problem isn't so much creating them it's what I link them too. As I say, when I deactivate the basic CSS the sprite images already in place for the RSS module, and small navigation buttons, no longer works. So their .sprite-icon_whatever class no longer works. I will try later on to see if I can replace them with a #i_icon_whatever ID. I'm not sure what forum topic buttons are under either, but I'm assuming the cp associates an ID with them, so I can style the links in pic management?

coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

Re: Implementing CSS sprites

Post by coco moco on July 20th 2011, 9:08 am

*Bump*

Still not found a way to implement my own sprites for the buttons. I still can't switch off the basic CSS without losing the addthis buttons in "share".

Perhaps, I'm asking about this in the wrong way - how do you get rollover effects for multi-quote, quote, edit, etc?

How do you change the icons in addthis/"share", and their rollover effects?

Why do the sprites already in place as standard only work with the basic CSS switched on, even though it's specified in my CSS?

Why is a job that should have taken a few hours, taking days?

I know sprites aren't the be all and end all, but it's a practice I've become accustomed to.

coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

Re: Implementing CSS sprites

Post by flyingfisch on July 20th 2011, 11:04 pm

CSS Sprites are generally finicky. You may want to go to http://www.csstricks.com and search "CSS Sprites". This has several tools you can use.

flyingfisch
Forumember

Male Posts : 61
Reputation : 10
Language : English
Location : OH

http://atgworldwide.freeinvision.net

Back to top Go down

Re: Implementing CSS sprites

Post by coco moco on July 21st 2011, 9:56 am

Thanks for that, but the creation of them, and the CSS that goes with them isn't the problem.

The problem is, even though I have the right elements to add the CSS to, they won't do anything. In fact, the sprites already in place, the original ones that came with the theme are still being loaded.

My first thought was the basic CSS was taking priority, and all that needed to happen was disabling it and replacing it with my own.

Well, their sprites do get disabled, and even though I have my own specified, one of which is their code and their sprite - I get nada. My code isn't wrong, my alignment isn't wrong, the elements I'm targetting aren't wrong. I have even gone to the extent of setting up a dummy page to see if it will work there - and IT DOES. I'm not using Opera, the image width is less than 2042px, even if I was. I'm also not viewing a cached copy of my site - that's all been cleared and I'm forcing it to load the newest version (that makes surfing very slow).

I've tried playing around with the pics display to see if I could add new classes/ids (bad coding I know for things that are already specified) - but that doesn't do anything.

I've gone through all the scripts on the site to see if something is taking precedent -"share" uses jscript to do the addthis stuff, but is still using a sprite for it's images (at***, etc), nothing seems to be, though their does appear to be multiple sprites of the same thing loading (new one on me - and both versions look fine for dynamic environs - not sure why a horizontal and vertical version is needed????).

The guys over at the phpbb3 forums are sorting out the prosilver skin - refactoring, adding sprites, etc. I had a look over their code and it is in essence what I've been trying to add.

What I'm doing *should* be working, but there is a mysterious element X that seems to override it - apart from the navbar sprite that's running fine.

It may not seem like a huge difference - fast broadband nowadays and all that - but for the navbar rollover there is a delay without using the sprite, where all you see - until you take off the pointer and move back over it - is a white space. With the sprite there is no delay and no white spaces.

Furthermore, it doesn't seem rollover effects for the "quote", "multi-quote", "edit", "new topic", etc will be possible without using jscript - which is a stupid way round for a shortcut, as it adds in more weight, more images and another declaration for those with jscript turned off. Fair enough there probably won't be the lag with the jscript as images are preloaded, but the first visit will still be slowed down. I also have my doubts as to whether it will work, as the ids and classes associated with the images I'm trying to sprite don't seem to do anything outside of the basic CSS.

It's more than a little irritating Sad

The really funny thing is, pretty much automatic spriting would be easy to implement in the admin cp. It's just a little jscript. That addition would not only make me a happy bunny - think of the thousands upon thousands of unnecessary server requests being cut down. I'm assuming forumotion is primarily monetised by using the free forums as an advertising network? Surely, cutting down their server costs would be of benefit? Also, the high volume forums would be faster, which would mean higher new customer retention, which could have the knock on effect of more ads converting. It's almost a no-brainer.

/end rant

coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

Re: Implementing CSS sprites

Post by flyingfisch on July 21st 2011, 2:44 pm

/end rant
LOL

Yes, this is beginning to look very wierd. I wonder if you are the first to try sprites on a forumotion forum? Maybe you should try making a new test forum and checking to see if it still wont work.

I agree with you about having forumotion implement css sprites into the admin panel. Sprites, being the best all-around way to do rollovers, it seems that they would have already thought of that...



flyingfisch
Forumember

Male Posts : 61
Reputation : 10
Language : English
Location : OH

http://atgworldwide.freeinvision.net

Back to top Go down

Re: Implementing CSS sprites

Post by coco moco on July 21st 2011, 6:18 pm

I will test with some other themes on a test forum (nod). It's the only thing I've not done, and perhaps if something is "cracked" in my current theme I can do a fresh install of a clean theme. I have back-ups of my scripts and CSS so wouldn't take long to redo.

I find it hard to believe I'm the only that's wanted to do this, though. Sprites have been around for a good few years and are pretty much the standard for background images. At the end of the day, it's something that would be easily sorted with direct access to the HTML. Sad

EDIT: It doesn't work on the test forum either ;( It works perfectly when I set up snippets of the same HTML and CSS, though. I really don't get it.

coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

Re: Implementing CSS sprites

Post by flyingfisch on July 22nd 2011, 3:05 pm

Very wierd. I think this is a topic that needs to be moved to the "Need a technician" forum.

flyingfisch
Forumember

Male Posts : 61
Reputation : 10
Language : English
Location : OH

http://atgworldwide.freeinvision.net

Back to top Go down

Re: Implementing CSS sprites

Post by coco moco on July 23rd 2011, 11:26 am

If it can't be solved I'm just going to have have single images for my buttons TT At least I've got the navbar to work as a sprite - not exactly wonderful, but better than nothing.

coco moco
Forumember

Posts : 118
Reputation : 50
Language : English

Back to top Go down

Re: Implementing CSS sprites

Post by Road9494 on July 26th 2011, 8:21 am

great postttttttttt









Spam Removed ~ Base

Road9494
New Member

Posts : 1
Reputation : 0
Language : ENGLISH

Back to top Go down

Re: Implementing CSS sprites

Post by SLGray on July 26th 2011, 8:25 am

@Road9494 wrote:great postttttttttt









Coach Jewelry killed discount coach outlet but saved office 2010

I guess the new update is not turn on here. Joined: 07/26/2011

SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Re: Implementing CSS sprites

Post by kirk on July 28th 2011, 12:07 am

see i dont use sprites, i use spy-menues and phpbb2,
i would have to look into it more for you and try to understand a little bit better.

slg wrote:
@Road9494 wrote:great postttttttttt









Coach Jewelry killed discount coach outlet but saved office 2010

I guess the new update is not turn on here. Joined: 07/26/2011

yeah lol.
turkey is banned now.



kirk
Forumaster

Male Posts : 11037
Reputation : 651
Language : English,Vulcan,Klingon, Romulan,& Gorn

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum