How would I show text inside a span tag when hovering over a different element?

twcool

I have a webpage set up that has multiple DIV tags in a grid like table. I would like to know if it's possible by using CSS to show text when mousing over a DIV or IMG or A tag. I could use any of those 3 to make it happen since one of my DIV tags holds just the IMG which is also a hyperlink to a new page. A sample of one of my rows in my page is setup kinda like this:

    <div class="Home-06">
    <a href="image1link.html">
    <img src="images/image1.jpg" width="250" height="250" alt="" 
        style="border-width: 0px"></a>
</div>
<div class="Home-07">
    <span>Text for Image 1</span><span>Text for Image 2</span>
</div>
<div class="Home-08">
    <a href="image2link.html">
    <img src="images/image2.jpg" width="250" height="250" alt="" 
        style="border-width: 0px"></a>
</div>

I'd like to make the middle DIV "Home-07" with my span tags display different text when hovering over "Home-06" and "Home-08".

My CSS:

div.Home-06 {
position:absolute;
left:102px;
top:450px;
width:250px;
height:250px;
}
div.Home-07 {
position:absolute;
left:352px;
top:450px;
width:320px;
height:250px;
background-color:#000000;
}
div.Home-08 {
position:absolute;
left:672px;
top:450px;
width:250px;
height:250px;
}
Niffler

The easiest way to do this is if the span is contained within the element that you are hovering over, so for example:

<div class="alwaysshowme">
    <p>
        I can always be seen [hover over me!]
        <span class="showmeonhover"><br />I can only be seen on hover...</span>
    </p>
</div>

Then the CSS would be:

.showmeonhover { display: none; }
.alwaysshowme:hover .showmeonhover {
    display: inline;
}

Here's a fiddle: http://jsfiddle.net/Niffler/d2kYq/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to change color of element when hovering over another element?

how to show a text when a button is clicked(button is surrounded by <span></span> tag)

How to show an image right next a text when hovering over it? The position of the image would have to change according to the length of the text

Get text inside a <p> element inside span tag with VBA

Javascript: How do i target selected elements in a slideshow when hovering over one element?

Change Text when hovering over image, text is in a different location then image

How do I push the text when I am hovering over an image?

I have an option form and I would like to show a different image from a JSON file for each element of the option tag i choose

How to show the value of each element when hovering

When hovering over li, how to make give the a a tag underline

Show text in a box when hovering over word

How do I trigger a click when hovering over a element for x seconds, using JQuery?

When hovering over <ul> I want another <ul> to show up

Show text over a image when hovering over it

How can I get the blue glow when hovering over a text input field?

Showing a span element only when hovering over an image

Show info when hovering over a tag

D3 - How can I show/hide a text element when hovering a circle element created from different attributes of the same data entry?

Xpath identifier for an span element with an 'i' tag inside it

How to get text inside one span tag to another span tag?

How would I make the box-shadow of my div fade in on hover (and out when not hovering over it)?

How would I make the transition smoother when hovering over button #2

I want to Pass the text inside anchor tag when clicked on that tag and to show the same text on the directed page

How to show span/label text into select tag

How can I make the text invisible when hovering over a tex and pressing the mouse button?

How can I make a element show when hovering over another element, and hide it if not. And make it take up space the entire time

Python Selenium - How to extract element based on text inside span tag?

How do I show text from a third dataframe column when hovering over a line chart made from 2 other columns?

How can I change one svg path ID element when hovering over another element