Help!, Rollover Code Help |
Help!, Rollover Code Help |
Jul 22 2009, 03:41 AM
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
Okay, I finally got the rollover thing down except I need to move my rollover image somewhere else.
How? CODE <style type="text/css">
div, table, tr, td, tbody {background-color:white;} a.home{ display: block; height: 50px; width: 116px; overflow: hidden; background-image: url("http://img24.imageshack.us/img24/2995/homexzf.png"); background-position: center; background-repeat: no-repeat; } a.home:hover{ background-image: url("http://img24.imageshack.us/img24/9471/home2w.png"); background-position: center; background-repeat: no-repeat; } </style> <a href="http://www.google.com/" class="home"> |
|
|
|
![]() |
Jul 22 2009, 04:02 AM
Post
#2
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
Exactly what do you mean? Do you need to position the rollover?
Just make DIV container to position it: CODE <div style="position:absolute; top:###px; _top:###px; left:50%; _left:50%; margin-left:-###px; _margin-left:-###px;">
<a href="http://www.google.com/" class="home"> </div> |
|
|
|
Jul 22 2009, 04:04 AM
Post
#3
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
Thank you! I was just putting the DIV container in the wrong place.
Thanks! |
|
|
|
Jul 22 2009, 04:05 AM
Post
#4
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
lol, no problem.
|
|
|
|
Jul 22 2009, 04:37 AM
Post
#5
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
![]() Okay how do I get the rollovers in one line? (Not stacked) CODE <style type="text/css">
div, table, tr, td, tbody {background-color:transparent;} a.home{ display: block; height: 50px; width: 116px; overflow: hidden; background-image: url("http://img24.imageshack.us/img24/2995/homexzf.png"); background-position: center; background-repeat: no-repeat; } a.home:hover{ background-image: url("http://img24.imageshack.us/img24/9471/home2w.png"); background-position:center; background-repeat: no-repeat; } a.message{ display: block; height: 50px; width: 176px; overflow: hidden; background-image: url("http://img193.imageshack.us/img193/5378/message2p.png"); background-position: center; background-repeat: no-repeat; } a.message:hover{ background-image: url("http://img22.imageshack.us/img22/9484/messagexma.png"); background-position:center; background-repeat: no-repeat; } a.comment{ display: block; height: 50px; width: 192px; overflow: hidden; background-image: url("http://img30.imageshack.us/img30/4681/commentlhk.png"); background-position: center; background-repeat: no-repeat; } a.comment:hover{ background-image: url("http://img33.imageshack.us/img33/2288/comment2.png"); background-position:center; background-repeat: no-repeat; } </style> <div style="position:absolute; top:20px; _top:50px; left:50%; _left:50%; margin-left:-250px; _margin-left:-150px;"> <a href="http://home.myspace.com/index.cfm?fuseaction=user" class="home"></a> <a href="http://messaging.myspace.com/index.cfm?fuseaction=mail.message&friendID=XXXXXXXX" class="message"></a> <a href="http://comment.myspace.com/index.cfm?fuseaction=user.viewProfile_commentForm&friendID=XXXXXXXX&MyToken=8b2108be-2301-4485-a399-e782c86fa854" class="comment"></a> </div>
Reason for edit: Please use [codebox] tags instead of [code] tags when posting longer codes. - Mike
|
|
|
|
Jul 22 2009, 05:23 AM
Post
#6
|
|
|
Treasure Pleasure ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Head Staff Posts: 11,193 Joined: Oct 2005 Member No: 281,127 |
Replace your code with this:
CODE <style type="text/css">
div, table, tr, td, tbody {background-color:transparent;} a.home{ height: 50px; width: 116px; overflow: hidden; background-image: url("http://img24.imageshack.us/img24/2995/homexzf.png"); background-position: center; background-repeat: no-repeat; } a.home:hover{ background-image: url("http://img24.imageshack.us/img24/9471/home2w.png"); background-position:center; background-repeat: no-repeat; } a.message{ height: 50px; width: 176px; overflow: hidden; background-image: url("http://img193.imageshack.us/img193/5378/message2p.png"); background-position: center; background-repeat: no-repeat; } a.message:hover{ background-image: url("http://img22.imageshack.us/img22/9484/messagexma.png"); background-position:center; background-repeat: no-repeat; } a.comment{ height: 50px; width: 192px; overflow: hidden; background-image: url("http://img30.imageshack.us/img30/4681/commentlhk.png"); background-position: center; background-repeat: no-repeat; } a.comment:hover{ background-image: url("http://img33.imageshack.us/img33/2288/comment2.png"); background-position:center; background-repeat: no-repeat; } </style> <div style="position:absolute; top:20px; _top:50px; left:50%; _left:50%; margin-left:-250px; _margin-left:-150px;"> <a href="http://home.myspace.com/index.cfm?fuseaction=user" class="home"></a> <a href="http://messaging.myspace.com/index.cfm?fuseaction=mail.message&friendID=XXXXXXXX" class="message"></a> <a href="http://comment.myspace.com/index.cfm?fuseaction=user.viewProfile_commentForm&friendID=XXXXXXXX&MyToken=8b2108be-2301-4485-a399-e782c86fa854" class="comment"></a> </div> |
|
|
|
Jul 22 2009, 05:44 AM
Post
#7
|
|
|
Irrisistable Cabbages. ![]() ![]() ![]() ![]() ![]() Group: Member Posts: 549 Joined: Nov 2007 Member No: 589,355 |
^^ You could've just told him to remove the display: block; in the code.
|
|
|
|
Jul 22 2009, 02:26 PM
Post
#8
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
yeah that made them just disappear.
|
|
|
|
Jul 22 2009, 02:37 PM
Post
#9
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
Put them all in a separate DIV container.
CODE <div style="position:absolute; top:###px; _top:###px; left:50%; _left:50%; margin-left:-###px; _margin-left:-###px;"> <a href="#" class="home"> </div> <div style="position:absolute; top:###px; _top:###px; left:50%; _left:50%; margin-left:-###px; _margin-left:-###px;"> <a href="#" class="message"> </div> <div style="position:absolute; top:###px; _top:###px; left:50%; _left:50%; margin-left:-###px; _margin-left:-###px;"> <a href="#" class="comment"> </div> Replace the pound symbols with the appropriate values. You don't have to remove the display:block; from your codes. EDIT: Or are you putting them all in one DIV container? If you are, you should use a different rollover code. |
|
|
|
Jul 22 2009, 02:42 PM
Post
#10
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
Well I had them all in one DIV container but putting them in separate ones like you said, worked.
|
|
|
|
Jul 22 2009, 02:46 PM
Post
#11
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
Ok. There is another code you could use though that will allow you to have them all in on DIV container. I could tell you if you want.
|
|
|
|
Jul 22 2009, 02:50 PM
Post
#12
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
If you want to, I mean if the code is easier, than sure.
|
|
|
|
Jul 22 2009, 02:52 PM
Post
#13
|
|
|
Treasure Pleasure ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Head Staff Posts: 11,193 Joined: Oct 2005 Member No: 281,127 |
Try this method.
|
|
|
|
Jul 22 2009, 03:02 PM
Post
#14
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
^ What Mike posted can work, or you could also try one of my favorite methods which can be found here.
|
|
|
|
Jul 22 2009, 03:07 PM
Post
#15
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
^That one is kinda confusing. XD
But with the one Mike posted works, except for having them staked up again. |
|
|
|
Jul 22 2009, 03:18 PM
Post
#16
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
You could also do the same method that I linked to but just more simpler.
Simply open the image that represents the normal state of the rollover. Now make the canvas size's height twice as high as the original image's height. Make sure your normal state is in the top half. Now paste the image that represents the hover state of the rollover into the bottom half. Save that image and upload it to the web. Once you have the URL of the image, use this code: CODE <style> a.CLASS_NAME {width:###px; height:###px; background-image: url("URL_OF_SAVED_IMAGE"); background-repeat:no-repeat; background-position:top left;} a.CLASS_NAME:hover {width:###px; height:###px; background-image: url("URL_OF_SAVED_IMAGE"); background-repeat:no-repeat; background-position:bottom left;}</style> I assume you know how to replace the fillers and such. One thing though, when you're putting in the value for the height, put half of the height of the saved image since your saved image is double the height of the rollover. We do this because you'll notice for the background position, we have top left as the value before the rollover and bottom left as the value after rollover. Since we inserted half the height, we cut the saved image in two halves and the background position tells the image to display either the top or bottom half. Now, all you have to do is add your DIV code and your done. (Remember, just repeat the first code for every new rollover.) CODE <div style="position:absolute; top:###px; _top:###px; left:50%; _left:50%; margin-left:-###px; _margin-left:-###px;"> <a href="#" class="CLASS_NAME"> <a href="#" class="CLASS_NAME2"> <a href="#" class="CLASS_NAME3"> </div> Just replace the fillers accordingly. Hopefully that wasn't too confusing. |
|
|
|
Jul 22 2009, 03:20 PM
Post
#17
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
Filters as in the class name?
|
|
|
|
Jul 22 2009, 03:21 PM
Post
#18
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
Yep. Along with the pound signs and all that mumbo jumbo.
|
|
|
|
Jul 22 2009, 03:25 PM
Post
#19
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
Haha. Okay. And for the images it would look like this:
![]() Correct? |
|
|
|
Jul 22 2009, 03:58 PM
Post
#20
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
Correct.
|
|
|
|
Jul 22 2009, 04:36 PM
Post
#21
|
|
![]() Mel Blanc was allergic to carrots. ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
^Or that. haha.
I didn't even see his codes had display:block; in them. LOL. xD |
|
|
|
Jul 22 2009, 04:54 PM
Post
#22
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
I'm just going to use my old code, and us seperate DIV Containers, that seems to work the best. And the quality of the images looks best when I do it that way.
Thanks you two! |
|
|
|
Jul 22 2009, 04:59 PM
Post
#23
|
|
|
Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Member Posts: 1,237 Joined: May 2008 Member No: 648,123 |
Float, float, float.
![]() Whenever you have something with a block display, and you want them lined up next to each other, use float:left;. You can also use display:inline-block;, but that doesn't work in older browsers, specifically Firefox 2. |
|
|
|
Jul 22 2009, 05:27 PM
Post
#24
|
|
![]() Senior Member ![]() ![]() ![]() Group: Official Designer Posts: 67 Joined: Aug 2008 Member No: 680,736 |
^ Thanks. Works, much easier than having like 6 Div Containers.
If I wanted to put a space between each rollover, instead of being pushed together, wouldn't I use: ? |
|
|
|
Jul 22 2009, 05:37 PM
Post
#25
|
|
|
Treasure Pleasure ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Head Staff Posts: 11,193 Joined: Oct 2005 Member No: 281,127 |
Posts merged.
|
|
|
|
![]() ![]() |