Search
Username:
Password:
Register or Reset Password
Remove the ads!
CSS/HTML Mouseover tutorial
Difficulty: Advanced
Category: FPSB > Other/MiscAuthor(s): Arez

This tutorial assumes that you have at least basic knowledge pertaining to HTML as well as CSS.

In this tutorial I am going to teach you how to make an image mouseover effect on your website without using either javascript or flash. More specifically for links. In the conclusion of our tutorial the resulting effect will be: LINK.

To begin, let's create the two images we will be using for the link, I don't recommend doing this with the image size I've chosen, it would be better to use this effect as a button of some sort.

IMAGE 1


IMAGE 2


Generally, you would use code like so:


DO NOT USE!
a.image {
display: block;
width: 200px;
height: 200px;
background-image: url('image.png');
background-repeat: no-repeat;
}

a.image:hover {
display: block;
width: 200px;
height: 200px;
background-image: url('image2.png');
background-repeat: no-repeat;
}


However, HTML will not parse divider tags that use background-image in a href tags(I mean as an a href, not inside the tag itself). So, we need to innovate. Inside of your style.css file put the following code:

div#customlink {
display: block;
width: IMAGE WIDTH FOLLOWED IMMEDIATELY BY px;
height: IMAGE HEIGHT FOLLOWED IMMEDIATELY BY px;
background-image: url('URL OF IMAGE BEFORE MOUSEOVER');
background-repeat: no-repeat;
float:left;
}

div#customlink:visited {
display: block;
width: IMAGE WIDTH FOLLOWED IMMEDIATELY BY px;
height: IMAGE HEIGHT FOLLOWED IMMEDIATELY BY px;
background-image: url('URL OF IMAGE BEFORE MOUSEOVER');
background-repeat: no-repeat;
float:left;
}

div#customlink:hover {
display: block;
width: IMAGE WIDTH FOLLOWED IMMEDIATELY BY px;
height: IMAGE HEIGHT FOLLOWED IMMEDIATELY BY px;
background-image: url('URL OF IMAGE AFTER MOUSEOVER');
background-repeat: no-repeat;
float:left;
}

Now, all you need to do is use the following HTML inside of your index.html(or whatever .html) file.

<a href="http://www.fpsbanana.com/members/190859"><div id="tutex"></div></a>


Once you input that into where ever you want it to go it should work properly. Feel free to leave me a message if it doesn't. I hope you enjoyed this simple little tutorial, if you have any basic HTML or CSS questions feel free to ask those as well, I don't mind answering. You're outcome should be similar to this, depending on which images you used.
Added: 3 months agoTags: css, mouseover, website
Feedback (4)
nrg_clane .
I Got The Detonators !!Y2M
Posted 1 month ago
How can i create a Stroked out text ??
like in a check list ?

sorry but i dont know who to ask

Clane
- I Got The Detonators !!
.
PM me for spray assessments!Y2M
Posted 3 months ago
Posted by paul

I don't get a mouseover affect when on image1. I also don't understand this tutorial. Lol.

1: Image 1 is the image we are using to create the final effect, it will be merged with Image 2, you can't scroll over it for a reason... See the HTML and CSS links in big yellow letters at the top of the tutorial? Click them before you post something like this again...

2: You wouldn't.

3: Lol.

Edit: Thanks for the feedback Klexicon. I would thumb your feedback for actually being insightful, but I can't. :P
.
Y2M
Posted 3 months ago
This tutorial really helps for people who don't know flash or Javascript, or simply are lazy as hell (Me). The grammar in this makes everything very simple to understand.

Ive already given you tips such as the adding some color to things that need to be changed by the user, and a little note about the code not to use.

All in all this is a very helpful tutorial. I can see this as being a stepping stone for many people new to Web development, or people just generally, trying to expand their knowledge. (I for one didn't know you could do this, and I know a little bit about web design).

So, thank you for this tutorial, I hope to see more from you in the future.
.
Rock, Paper, SCIENCE.Y2M
Posted 3 months ago
I don't get a mouseover affect when on image1. I also don't understand this tutorial. Lol.
Add Feedback
Provide constructive feedback. What is "constructive"?
You cannot post yet!
Get involved on FPSB by posting your thoughts. Give authors your feedback to help them develop.

To post in this submission register or login.
Assessment
The community's verdict.
User Rating [+]
10/10
bScore
10.0/10
You cannot assess yet!
Moderating FPSB is in your hands - when you assess a submission your vote determines its success or failure.

To vote on this submission register or login.
Stamps
This Tutorial in a nutshell...
No stamps recorded
You cannot stamp yet!
Stamps let you apply characteristics to submissions to help others understand them.

To stamp this submission register or login.


Brought to you by...
+1 Studio of Skill
Gaining XP since 1776
Membership: Invite Only
Primary Skills: Graphic Design, Modelling, Texturing
Inception: 5 months ago
Vote for Studio
Like this tut? Vote +1 Studio of Skill for one or more monthly awards.
You must login or register to access this!
Related Tutorials