473,662 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make a div with image a:hover?

Hi,

I am wondering if someone could guide me in the right direction about
this. How can I make div 'one' hover? Does not need to be
clickable/link...It would be easy if the images was not there..But now
it is..

<div class="one"><im g src="img/someimage.gif" alt="" /><a
href="index.php ">Text bla bla bla</a></div>

I know that I have to do something like:

..one a {
display: block;
width: 200px;
height: 40px;
background-color: #f1f1f1;
padding: 5px;
}

..one a:hover {
display: block;
width: 200px;
height: 40px;
background-color: #ccccc;
padding: 5px;
}

Anyone know how?

Greetings and thanks from Gnolen
Jul 21 '05 #1
3 8219
In article <11************ *******@newsb.t elia.net>, he***********@h otmail.com
enlightened us with...
I am wondering if someone could guide me in the right direction about
this. How can I make div 'one' hover?


I don't think that's supported until CSS2, but don't quote me.

I know you can do this with javascript.
<div class="one" onMouseOver="so meFunction()" onMouseOut="som eOtherFunction
()">

--
--
~kaeli~
Suicide is the most sincere form of self-criticism.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 21 '05 #2
Gnolen wrote:
Hi,

I am wondering if someone could guide me in the right direction about
this. How can I make div 'one' hover? Does not need to be
clickable/link...It would be easy if the images was not there..But now
it is..

<div class="one"><im g src="img/someimage.gif" alt="" /><a
href="index.php ">Text bla bla bla</a></div>

I know that I have to do something like:

.one a {
display: block;
width: 200px;
height: 40px;
background-color: #f1f1f1;
padding: 5px;
}

.one a:hover {
display: block;
width: 200px;
height: 40px;
background-color: #ccccc;
padding: 5px;
}

Anyone know how?

Greetings and thanks from Gnolen

IE only supports :hover on anchors with a href.
(think Gecko supports :hover on many more elements)
make the a 'display: block' and remove the div.
of course, in the hover you only add what changes.
if you really want you can put the image in the background.

a.one {
display: block;
width: 200px;
height: 40px;
padding: 5px;
background-color: #eee;
background-image: url(img/someimage.gif);
background-repeat: no-repeat;
}

a.one:hover {
background-color: #ccc;
}

<a class="one" href="index.php ">Text bla bla bla</a>
gl
martin
Jul 21 '05 #3
to make sure your text will appear below to the image you can ajust the
padding

a.one {
padding: 45px 5px 5px 5px;
}

this will make your a-block 45+40+5 px high (in standard mode)
unless you add so much text that it doesnt fit, in that case IE will
stretch your a-block , and in gecko it will appear growing outside the
a-block
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3475
by: Chris Beall | last post by:
I'm displaying an image that is also a link against a black background. In Netscape 7.1, the current background color is displayed as a horizontal bar below the image. This allows :hover effects that change the background color to have a visible effect, as this bar changes color. By default, it appears that the color is inherited from the body color, i.e. with no link style applied, the bar is black, and invisible against the background....
8
12793
by: JLahm | last post by:
I have defined a class for my images called .image that specifies the default border color, width and style. I'd like to be able to have the pseudo elements link, visited and active have one color and style, while the hover class has a different color and style. I have the entries: a:link .image { border-color: #151515; border-style: solid; border-width: 2px; }
2
3071
by: Elisa | last post by:
I have two images, each with defined CSS hover states. I would like a mouseover on one image to trigger the hover state of the other image. Is this possible using javascript? If so, how? Any help would be appreciated. Thanks, CJ
1
1111
by: NH | last post by:
Ok, I need to figure out the best way to create an image with a hyperlink with in. I have a gridview which lists peoples names, I want to put in a column that displays each persons summary data i.e. how much time they spent working on a project for a certain time period. I envisage that an image will need to be created for each person that is color-coded based on some criteria and will also contain a hyperlink to anther page. The image...
7
27487
by: fredo | last post by:
I've studied Eric Meyer's pure css popups, version two: http://meyerweb.com/eric/css/edge/popups/demo2.html which pops up an image when I roll over a text link. Now I want to pop up a large image when I roll over a thumbnail. I've tried some things, but can't make it work. See here (Warning: adult matter):
2
9349
by: Riverburn | last post by:
I've got a question regarding making menu's in Css. I've made a picture of the menu in photoshop, have made the mouseover effect in different frames, and made a quick pregenerated html/javascript menu with Imageready. (The menu with simple html tables, and the mouseover effect with javascript). However, this is not the best way, Css can do more. I've done this before, but someone told me I'm not doing it right. what I did is, make a Css...
1
2445
by: nicky77 | last post by:
Hi, I've created a nav bar using a background image for rollover effects. Everything works as I had hoped, however, for some reason it seems that an area of whitespace (the same size of the background image) is hyperlinked underneath the nav bar. I can't see any errors in the coding below. Any ideas what may be causing this? the page is at http://www.maguiresonline.co.uk/wosis/files/nickysnav.html the html.... <body...
8
6545
by: Haines Brown | last post by:
I want a hot text string to display an image only when hovered. In the body: .... <a id="link-a" href="#nogo"> <img id="photo" src="..." />hot text </a> ....
16
4926
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of "background" or "background-image", the positioning only works with specifying pixels. If I specify the vertical position in pixels, the image gets cut-off at the bottom. I don't know what to do and would appreciate anyone's help. Specifically the code...
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.