Title: Featured image header
Last modified: August 30, 2016

---

# Featured image header

 *  [foremanm](https://wordpress.org/support/users/foremanm/)
 * (@foremanm)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/featured-image-header-1/)
 * I am trying to use the featured image and header work similar to [this](https://iso.500px.com/5-things-the-best-selling-photos-of-people-have-in-common/)
   but I cannot seem to get it to work. The image only covers the part of the div
   that has the text. The full image is not showing.
 * Here is my code:
 *     ```
       <?php if (has_post_thumbnail( $post->ID ) ): ?>
       	<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
       	$image = $image[0]; ?>
       	<?php else :
       	$image = get_bloginfo( 'stylesheet_directory') . '/images/default_cat_img.jpg'; ?>
       	<?php endif; ?>
       	<div class="featimg" style="background-image: url('<?php echo $image; ?>')" >
       		<h1 class="entry-title"><?php the_title(); ?></h1>
       	</div><!-- end #featimg -->
   
       css:
        .featimg {
           position: relative;
       }
       .single .featimg, .page .featimg, .home .featimg {
           position: relative;
           line-height: 0;
           text-align: center;
       }
       .featimg{
           height: 100%;
           width: 100%;
           left: 0;
           right: 0;
           top: 0;
           bottom: 0;
           background-size: cover !important;
           position: absolute;
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  [Will Schmierer](https://wordpress.org/support/users/officialwill/)
 * (@officialwill)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/featured-image-header-1/#post-6640195)
 * It’s a little hard to tell exactly from just this, but you might want to add 
   something like this as well.
 * `background-position: 50% 50%;`
 *  If you have a link it might help to troubleshoot better?

Viewing 1 replies (of 1 total)

The topic ‘Featured image header’ is closed to new replies.

## Tags

 * ["background-image"](https://wordpress.org/support/topic-tag/background-image/)
 * [featured image](https://wordpress.org/support/topic-tag/featured-image/)
 * [header](https://wordpress.org/support/topic-tag/header/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Will Schmierer](https://wordpress.org/support/users/officialwill/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/featured-image-header-1/#post-6640195)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
