9 replies [Last post]
webster12345
webster12345's picture
User offline. Last seen 1 year 38 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2010-07-23
Posts: 25
Points: 35

hI all

I have several images, each of which hyperlink to videos. i would like to make it feel more interesting so that when the user hovers over the image a border appears around the image.
so my question is, do i have to create a seperate hover style for all my images that link to the videos?

I have already created an a.hover for all my text links. It's called #centerColumn #textlinks a:hover

At the momment my html code for my images is something like this

<div class="float-left"><a href="videos/intro.wmv"><img src="images/Intro-320.jpg" alt="one" width="320" height="256" border="2" /></a>
   <p>Introduction from Mr king</p>
 
</div>

My css that i use to float the images is

}
.float-left {
	width: 320px;
	margin-left: 150px;
	float: left;
	height: 256px;
}

petz_e
petz_e's picture
User offline. Last seen 1 year 41 weeks ago. Offline
newbie
Timezone: GMT+2
Joined: 2010-08-03
Posts: 3
Points: 4

Hi, If you are using the

Hi,

If you are using the "float-left" divs only as container for the images you can add this to the CSS:

.float-left a:hover {
	outline: 2px solid #f90;
}
 
img {
	border: 0;
}

CupidsToejam
CupidsToejam's picture
User offline. Last seen 17 weeks 6 hours ago. Offline
rank Guru
Guru
Timezone: GMT-6
Joined: 2008-08-15
Posts: 2634
Points: 1552

webster12345, try this way. I

webster12345, try this way. I do it all the time. Borders will need to be on the inactive and hover states of the images, or they will jump on hover.

img {border: 2px solid transparent;}
img:hover {border: 2px solid #e0e0e0;}


First basic few steps in building a webpage
1. Gather and collect content.
2. Organize the content into meaningful semantic valid HTML
3. Design the prototype
4. Style using CSS

http://www.pixelbehavior.com

webster12345
webster12345's picture
User offline. Last seen 1 year 38 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2010-07-23
Posts: 25
Points: 35

Hi Petz_e Thanks, this method

Hi Petz_e

Thanks, this method works nicely, just one query, i changed the value of border:0; to 5, but nothing seemed to happen. I thought maybe it would give the image a border from which it then jumped to outline 2px when the mouse hovered over it.

What if i want to give the image a border to begin with which then swaps to outline 2px solid #f90;

Smile

webster12345
webster12345's picture
User offline. Last seen 1 year 38 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2010-07-23
Posts: 25
Points: 35

Hi CupidsToejam Thanks for

Hi CupidsToejam

Thanks for suggestion, but im not sure where exaclty to place this code ?

I tried adding the two lines to my .float-left and then tried .float-left a:hover, but neither seemed to work. See what i tried with your code below. I suspect i have misunderstood you.

.float-left a:hover {
 
img {border: 2px solid transparent;}
img:hover {border: 2px solid #e0e0e0;}	
}
 
 
.float-left { 
 
 
	width: 320px;
	margin-left: 150px;
	float: left;
	height: 256px;
img {border: 2px solid transparent;}
img:hover {border: 2px solid #e0e0e0;}
 
 
}

CupidsToejam
CupidsToejam's picture
User offline. Last seen 17 weeks 6 hours ago. Offline
rank Guru
Guru
Timezone: GMT-6
Joined: 2008-08-15
Posts: 2634
Points: 1552

it would be

it would be this...

.float-left img {border: 2px solid transparent;}
.float-left img:hover {border: 2px solid #e0e0e0;}

This will style the image only.


First basic few steps in building a webpage
1. Gather and collect content.
2. Organize the content into meaningful semantic valid HTML
3. Design the prototype
4. Style using CSS

http://www.pixelbehavior.com

webster12345
webster12345's picture
User offline. Last seen 1 year 38 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2010-07-23
Posts: 25
Points: 35

Many thanks for this

Many thanks for this feedback.

Smile

webster12345
webster12345's picture
User offline. Last seen 1 year 38 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2010-07-23
Posts: 25
Points: 35

hi CupidsToejam I just tried

hi CupidsToejam

I just tried exactly what you said

.float-left {
width: 320px;
margin-left: 50px;
float: left;
height: 256px;
margin-bottom: 50px;

img {border: 2px solid transparent;}
img:hover {border: 2px solid #e0e0e0;}
}

I even tried taking out the curly brackets after your two lines, but still no joy, sorry im probably being really dumb here.

.float-left {
width: 320px;
margin-left: 50px;
float: left;
height: 256px;
margin-bottom: 50px;

img {border: 2px solid transparent;
img:hover {border: 2px solid #e0e0e0;
}

Deuce
Deuce's picture
User offline. Last seen 4 weeks 5 days ago. Offline
rank Guru
Guru
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4421
Points: 1840

Why do you have those tags

Why do you have those tags nested inside other ones?

all ยป http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

webster12345
webster12345's picture
User offline. Last seen 1 year 38 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2010-07-23
Posts: 25
Points: 35

Hi Deuce Thanks for pointing

Hi Deuce

Thanks for pointing that out, i was was being really dumb, I have managed to get it working now. This is the best solution because i found by using the outline tag that it didnt work in ie 7. the border tag seemed to fix this.

Thanks everybody for helping me get there.