943,999 Members | Top Members by Rank

Ad:
Jul 12th, 2007
0

Javascript / css menu image help, pls?

Expand Post »
Hi guys,

first & foremost, my apologies if this is posted in the wrong zone - feel welcome to move it if necessary.

OK, and on to my situation...

I'm attempting to rewrite my navigation bar (vbulletin) to use images as oppose plain text. I used to frontpage2003 to start me off (I'm absolutely inexperienced to the lowest level). It all works fine (using 'interactive buttons') on frontpage, but it doesn't work one bit when applied to the templates.

I have zero experience in css & java/javascript so really I'm asking for the most basic of assistance to get me going here.

I'd like to have my navbar so it has - similar to daniweb's navbar by chance - an image that says "User CP" in blue... when hovered, the 'ink' changes to a red, and when clicked the whole image changes again to reflect a 'depressed button' and deep blue ink for the text.

I know it's an easy task, and I apologise for asking such easily answered questions, but I have googled for well over an hour now in an effort to find out what I should be doing.

Allt he information I can locate though doesn't appear to be helping me one bit. Thus, here I am... Any help at all, greatly appreciated.

Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
karlm is offline Offline
16 posts
since May 2007
Jul 12th, 2007
0

Re: Javascript / css menu image help, pls?

Here's a simplified way to do it in CSS.
HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title></title>
  4. <style type="text/css">
  5. a:link {
  6. text-decoration: none;
  7. color: red;
  8. background-color: yellow;
  9. }
  10. a:visited {
  11. text-decoration: none;
  12. color: black;
  13. background-color: blue;
  14. }
  15. a:hover {
  16. text-decoration: underline;
  17. color: green;
  18. background-color: gray;
  19. }
  20. a:active {
  21. text-decoration: none;
  22. color: silver;
  23. background-color: cyan;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <a href="http://www.daniweb.com">Daniweb</a>
  29. </body>
  30. </html>

You can change the colours around between the style tags.

This can be done using your own images using rollover buttons instead.
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006
Jul 12th, 2007
0

Re: Javascript / css menu image help, pls?

Thank you very kindly, Cerberus, for the head start - I checked it out with frontpage and it works like a dream.
Now, forgive my ignorance - I can see how such a clean script works, using text, but how might I add images?
e.g. say I have three tabs I'd like to use, each has three colours:

tab1-standalone
tab1-hover
tab1-click/ed
tab2-standalone
tab2-hover
tab2-click/ed
etc. etc.
?

thank you again for such a great start on the path to CSS
Reputation Points: 10
Solved Threads: 0
Newbie Poster
karlm is offline Offline
16 posts
since May 2007
Jul 12th, 2007
0

Re: Javascript / css menu image help, pls?

I'm not sure how you do three images but i'll start you off with a simple roll over button.

HTML and CSS Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title></title>
  4. <style type="text/css">
  5. .usercp
  6. {
  7. background-image: url(usercp2.png);
  8. display: block;
  9. width: 50px;
  10. height: 30px;
  11. }
  12.  
  13. .usercp a
  14. {
  15. display: block;
  16. width: 50px;
  17. height: 30px;
  18. }
  19.  
  20. .usercp img {width: 50px; height: 30px; border: 0; }
  21. .usercp a:hover img{visibility:hidden}
  22. </style>
  23. </head>
  24. <body>
  25. <div class="usercp">
  26. <a href=""><img src="usercp.png"/></a>
  27. </div>
  28. </body>
  29. </html>
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006
Jul 12th, 2007
0

Re: Javascript / css menu image help, pls?

Thanks again got that working in frontpage.

Is there a means to use css so it's not in the head? Because that's where my issue was with changing navbar before, that i couldn't seem to add css into the header (nor headerinclude).
Thank you again
Reputation Points: 10
Solved Threads: 0
Newbie Poster
karlm is offline Offline
16 posts
since May 2007
Jul 12th, 2007
0

Re: Javascript / css menu image help, pls?

Click to Expand / Collapse  Quote originally posted by karlm ...
Thanks again got that working in frontpage.

Is there a means to use css so it's not in the head? Because that's where my issue was with changing navbar before, that i couldn't seem to add css into the header (nor headerinclude).
Thank you again
Yup just copy and paste the style code (delete the style tags completely) into a seperate file and call it something like mystyle.css. Then put the following code into the head tags...

<link rel="stylesheet" type="text/css" href="mystyle.css" />
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006
Jul 12th, 2007
0

Re: Javascript / css menu image help, pls?

Thank you very much Cerberus, if you click my sig, you'll see i have it working
thank you again
Last edited by karlm; Jul 12th, 2007 at 11:16 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
karlm is offline Offline
16 posts
since May 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Stupid CSS problem...
Next Thread in HTML and CSS Forum Timeline: Doctype difficulties





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC