Jump to content

Roll Over in x/HTML

Whether you're a seasoned veteran or a struggling beginner, Web Radiance is the web development and web design forum for you. You'll find answers to all your HTML, CSS, SEO, and Programming needs. Pull up a chair and stay awhile.

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

Roll Over in x/HTML Rate Topic: -----

#1 User is offline   sho88 

  • W.R. Corporal
  • Group: Members
  • Posts: 79
  • Joined: 03-August 06
  • Interests:Web Design and Athletics!

Posted 05 January 2007 - 05:25 AM

Hey guys, I'm creating a website for my uncle for his car business.
I'm proud to say that I've managed to create the website using notePad ONLY (and a bit of Adobe Phtoshop for graphics obviously).
I've chosen to learn x/HTML and CSS instead of relying on Dreamweaver etc.

Anyways, my main question is: how do you give an image a roll-over effect without the use of javascript? Isn't there any x/HTML code that you type in, instead of rollOut and all that stuff?

Isn't there a code like: "

<a href="index.html" hover="rover_icon1.png"> </a>" or something similiar....

Thanks a lot!
Sho

This post has been edited by sho88: 05 January 2007 - 05:33 AM

0

#2 User is offline   James Mitchell 

  • Legendary
  • Group: Administrators
  • Posts: 922
  • Joined: 26-July 06
  • Gender:Male
  • Location:Fort Wayne, IN

Posted 05 January 2007 - 08:28 AM

Not specifically through xHTML, but through CSS it is extremely easy (after you learn the technique).

You simply create either one image or multiple (depending on the technique you choose to use) and "slide" it in and out of place.

Here are a few places you can use to learn the techniques (or at least the two popular ones):Now have fun !

This post has been edited by JPMitchell: 05 January 2007 - 08:30 AM

Posted Image
0

#3 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 05 January 2007 - 08:49 AM

The sliding doors technique that James mentioned is absolutely the most seamless and smooth, and many top notch developers use it.

It isn't alone though, there are other techniques for swapping an image on hover, and here is another one:

I'll assume that you'll know how to change the below CSS to match your needs, class/ID names, etc.

a.navLink { /* the background image below will appear when no hover action is made */
background: url(path/to/regular-image.gif) no-repeat left top;
}

a.navLink:hover { /* the background image below will appear when a hover action is made */
background: url(path/to/hover-image.gif) no-repeat left top;
}


There are other style rules you'll have to create most likely, such as padding for those anchors, and potentially making them "display: block", but aside from the above code, it's all experimentation based on your design.

Regardless of which method you utilize, keep us in tune to how it is going and we'll all be glad to help with any more questions!
0

#4 User is offline   James Mitchell 

  • Legendary
  • Group: Administrators
  • Posts: 922
  • Joined: 26-July 06
  • Gender:Male
  • Location:Fort Wayne, IN

Posted 05 January 2007 - 08:55 AM

Correct me if I am wrong Marc, but with that method or just a straight up a:hover don't you get the flicker (in IE6)?
Posted Image
0

#5 User is offline   TJSingleton 

  • Allegedly Legendary
  • Group: Members
  • Posts: 517
  • Joined: 31-July 06
  • Location:Winder, GA

Posted 05 January 2007 - 12:23 PM

Just to stir things up. Should javascript or css be used for rollovers?
0

#6 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 05 January 2007 - 12:53 PM

View PostJPMitchell, on Jan 5 2007, 08:55 AM, said:

Correct me if I am wrong Marc, but with that method or just a straight up a:hover don't you get the flicker (in IE6)?

Oh I'm sure it does, and I might even bet in IE7 too.

IE = :shit:
0

#7 User is offline   James Mitchell 

  • Legendary
  • Group: Administrators
  • Posts: 922
  • Joined: 26-July 06
  • Gender:Male
  • Location:Fort Wayne, IN

Posted 05 January 2007 - 01:05 PM

View PostTJSingleton, on Jan 5 2007, 12:23 PM, said:

Just to stir things up. Should javascript or css be used for rollovers?

Personally, I don't think there is a "should be" answer. More a preference, maybe?
Posted Image
0

#8 User is offline   Catalyst 

  • Codesmith
  • Group: Administrators
  • Posts: 1,049
  • Joined: 04-April 06
  • Gender:Male
  • Location:San Diego

Posted 05 January 2007 - 02:53 PM

I think it's preference. I use javascript for my rollsovers due to the IE flicker. Some people don't find that a big issue and use CSS.
0

#9 User is offline   TJSingleton 

  • Allegedly Legendary
  • Group: Members
  • Posts: 517
  • Joined: 31-July 06
  • Location:Winder, GA

Posted 05 January 2007 - 02:58 PM

Is rollover presentation or behavior?
0

#10 User is offline   sho88 

  • W.R. Corporal
  • Group: Members
  • Posts: 79
  • Joined: 03-August 06
  • Interests:Web Design and Athletics!

Posted 05 January 2007 - 02:59 PM

View Postherkalees, on Jan 5 2007, 05:53 PM, said:

Oh I'm sure it does, and I might even bet in IE7 too.

IE = :shit:


HAHA! :lol:

Opera and Mozilla Firefox Rocks!
0

#11 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 05 January 2007 - 04:04 PM

View PostTJSingleton, on Jan 5 2007, 02:58 PM, said:

Is rollover presentation or behavior?

I'm sure this is quite debatable, so here I go:

I believe it is presentation, just as the text-underline is when hovering over a text link. But, I'm very open to be convinced otherwise!
0

#12 User is offline   Ben Abrams 

  • The buddy system:never fails
  • Group: Administrators
  • Posts: 1,850
  • Joined: 04-April 06
  • Gender:Male

Posted 05 January 2007 - 06:05 PM

View Postherkalees, on Jan 5 2007, 09:04 PM, said:

I'm sure this is quite debatable, so here I go:

I believe it is presentation, just as the text-underline is when hovering over a text link. But, I'm very open to be convinced otherwise!
i agree. The rollover is not essential, it wont matter if it didnt work at all. now, if on rolling over a menu popped out, then, thats behavior, its required by the navigation to browse the site.


balance between aesthetics and requirements

View PostSirkent, on 21 September 2007 - 04:26 AM, said:

<monty python high-pitched female voice>I DON'T LIKE SPAM!</monty python high-pitched female voice>
0

#13 User is offline   moojoo 

  • Argh!
  • Group: Members
  • Posts: 449
  • Joined: 03-August 06
  • Location:Texas

Posted 11 January 2007 - 11:45 AM

To eliminate the flicker in IE you use a single image with the two or 3 states you need and CSS to control them.

I.e

Normal 0px 0px
Hover 0px -100px

whatever...
Its not girly, its web 2.0!
0

#14 User is offline   James Mitchell 

  • Legendary
  • Group: Administrators
  • Posts: 922
  • Joined: 26-July 06
  • Gender:Male
  • Location:Fort Wayne, IN

Posted 11 January 2007 - 12:29 PM

View Postmoojoo, on Jan 11 2007, 11:45 AM, said:

Normal 0px 0px
Hover 0px -100px

Ah yes the simple "sliding technique" - for a full tutorial on that check out here.
Posted Image
0

#15 User is offline   BigMike Sidelka 

  • W.R. Sergeant
  • Group: Members
  • Posts: 241
  • Joined: 31-July 06
  • Gender:Male
  • Location:C-Town, Ohio

Posted 11 January 2007 - 09:19 PM

Also you can do

<a href="" onMouseOver="hover" onMouseOut="normal"></a>
0

#16 User is offline   James Mitchell 

  • Legendary
  • Group: Administrators
  • Posts: 922
  • Joined: 26-July 06
  • Gender:Male
  • Location:Fort Wayne, IN

Posted 11 January 2007 - 10:08 PM

View PostNewAge.Mike, on Jan 11 2007, 09:19 PM, said:

Also you can do

<a href="" onMouseOver="hover" onMouseOut="normal"></a>

Correct me but isn't that inline javascript?
Posted Image
0

#17 User is offline   Ryan Fait 

  • W.R. Sergeant
  • Group: Members
  • Posts: 204
  • Joined: 07-January 07
  • Location:Las Vegas

Posted 11 January 2007 - 11:10 PM

Yes, that's JavaScript. While it works, it's not the best method. If someone has JavaScript disabled, it won't work. I'm also a fan of the separation of Content (XHTML), Presentation (CSS) and Behaviors (JavaScript). If you really need to use JavaScript for something, reference the link by an id and then handle the function in an external script.
The commercial front for my freelance web design company.
0

#18 User is offline   moojoo 

  • Argh!
  • Group: Members
  • Posts: 449
  • Joined: 03-August 06
  • Location:Texas

Posted 12 January 2007 - 09:26 AM

I like the CSS way, I have done 4 state buttons with it and its a rocking.
Its not girly, its web 2.0!
0

#19 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 12 January 2007 - 11:15 AM

View Postmoojoo, on Jan 12 2007, 09:26 AM, said:

...its a rocking.

I won't come a-knocking.
0

#20 User is offline   moojoo 

  • Argh!
  • Group: Members
  • Posts: 449
  • Joined: 03-August 06
  • Location:Texas

Posted 12 January 2007 - 12:07 PM

http://www.newguyine...ples/css_hover/
Its not girly, its web 2.0!
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users