html - how to hover the whole element no matter what -


i have structure html:

<span class='something'>   <a href="" title="description">     <img src="/assets/no-image.png" alt="description" title="description" />     <div class="info">       <div class="title">title</div>       <div class="subtitle">subtitle</div>     </div>   </a> </span> 

and css:

.something {   display: block;   div.info {     display: none;   }   a:hover {     display: block;     width: 150px;     height: 150px;     background: green;     img:hover {       filter: alpha(opacity = 30);       opacity: .30;              }     div.title, div.subtitle {       display: block;     }     div.info {       display: block;       position: relative;       margin-top: -145px;     }   } } 

when move cursor on <span class="something"> element, whole area overlayed green color. that's good. problem is, when move cursor on div elements inside <span class="something"> (which means on <div class="title"> , <div class="subtitle">), green background disappear.

i striving keep there green background if cursor on 2 divs.

how using css? or need used javascript?

first of html semantically invalid. cannot have block elements inside inline elements.

change span div

// css

.something {   display: inline-block;   padding: 10px; } .something:hover {   background: green; } .something:hover .info {   display: block; } .something:hover .title {   display: block; } .something:hover .subtitle {   display: block; } .something .info {   display: none; } .something .title {   display: none; } .something .subtitle {   display: none; } .something img {   height: 150px;   width: 150px; } 

markup

<div class="something">         <a href="#">             <img src="../styles/images/desert.jpg" />         </a>          <div class="info">             <div class="title">title</div>             <div class="subtitle">subtitle</div>         </div>     </div> 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -