Skip to main content
shortened CSS, improved formatting
Source Link
tfrommen
  • 9.2k
  • 7
  • 39
  • 59

alternativeAlternative approach:

<li class="cycle-item slide-<?php echo $i; ?>">
   <span class="featured-title"><?php the_title(); ?></span>
   <a href="<?php the_permalink();?>"><?php   the_post_thumbnail('featured'); ?></a>
</li>

then hide the span with cssCSS, show it on hover of the li<li> element, position it over the image with css;CSS.

exampleExample:

li.cycle-item { 
    position: relative; 
  }
span
li.cycle-item .featured-title { 
    display: none; 
  } 

li.cycle-item:hover span.featured-title { 
    display: block;
    position: absolute;
    top: 20%;
    left: 0; 
  }

alternative approach:

<li class="cycle-item slide-<?php echo $i; ?>">
   <span class="featured-title"><?php the_title(); ?></span>
   <a href="<?php the_permalink();?>"><?php   the_post_thumbnail('featured'); ?></a>
</li>

then hide the span with css, show it on hover of the li element, position it over the image with css;

example:

li.cycle-item { 
  position: relative; 
  }
span.featured-title { 
  display: none; 
  }
li.cycle-item:hover span.featured-title { 
  display: block; position: absolute; top: 20%; left: 0; 
  }

Alternative approach:

<li class="cycle-item slide-<?php echo $i; ?>">
   <span class="featured-title"><?php the_title(); ?></span>
   <a href="<?php the_permalink();?>"><?php the_post_thumbnail('featured'); ?></a>
</li>

then hide the span with CSS, show it on hover of the <li> element, position it over the image with CSS.

Example:

li.cycle-item { 
    position: relative; 
}

li.cycle-item .featured-title { 
    display: none; 
} 

li.cycle-item:hover .featured-title { 
    display: block;
    position: absolute;
    top: 20%;
    left: 0; 
}

alternative approach:

<li class="cycle-item slide-<?php echo $i; ?>">
   <span class="featured-title"><?php the_title(); ?></span>
   <a href="<?php the_permalink();?>"><?php   the_post_thumbnail('featured'); ?></a>
</li>

then hide the span with css, show it on hover of the li element, position it over the image with css;

example:

li.cycle-item { 
  position: relative; 
  }
li.cycle-item span.featured-title { 
  display: none; 
  }
li.cycle-item:hover span.featured-title { 
  display: block; position: absolute; top: 20%; left: 0; 
  }

alternative approach:

<li class="cycle-item slide-<?php echo $i; ?>">
   <span class="featured-title"><?php the_title(); ?></span>
   <a href="<?php the_permalink();?>"><?php   the_post_thumbnail('featured'); ?></a>
</li>

then hide the span with css, show it on hover of the li element, position it over the image with css;

example:

li.cycle-item { 
  position: relative; 
  }
li.cycle-item span.featured-title { 
  display: none; 
  }
li.cycle-item:hover span.featured-title { 
  display: block; position: absolute; top: 20%; left: 0; 
  }

alternative approach:

<li class="cycle-item slide-<?php echo $i; ?>">
   <span class="featured-title"><?php the_title(); ?></span>
   <a href="<?php the_permalink();?>"><?php   the_post_thumbnail('featured'); ?></a>
</li>

then hide the span with css, show it on hover of the li element, position it over the image with css;

example:

li.cycle-item { 
  position: relative; 
  }
span.featured-title { 
  display: none; 
  }
li.cycle-item:hover span.featured-title { 
  display: block; position: absolute; top: 20%; left: 0; 
  }
Source Link
Michael
  • 8.4k
  • 3
  • 29
  • 31

alternative approach:

<li class="cycle-item slide-<?php echo $i; ?>">
   <span class="featured-title"><?php the_title(); ?></span>
   <a href="<?php the_permalink();?>"><?php   the_post_thumbnail('featured'); ?></a>
</li>

then hide the span with css, show it on hover of the li element, position it over the image with css;

example:

li.cycle-item { 
  position: relative; 
  }
li.cycle-item span.featured-title { 
  display: none; 
  }
li.cycle-item:hover span.featured-title { 
  display: block; position: absolute; top: 20%; left: 0; 
  }