Title: CSS not working for permalink
Last modified: August 21, 2016

---

# CSS not working for permalink

 *  [CombatPost](https://wordpress.org/support/users/combatpost/)
 * (@combatpost)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/)
 * Hi all,
 * I’m trying to link a title and authors name from my front page (News reel). I
   have no problem linking them, but styling the links seems impossible.
 * I link them as follows:
    `<a href="<?php the_permalink(); ?>" rel="bookmark">
   <h1><?php the_title(); ?></h1></a>`
 * The styling I then have is:
    `.main-text h1 a:hover{ text-decoration: underline;}`
 * No dice. I’ve tried a few different things and get nothing working.
 * [http://www.mmamount.com](http://www.mmamount.com)
 * Any help is appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Arnel C.](https://wordpress.org/support/users/arncus/)
 * (@arncus)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276772)
 * Hello CombatPost,
 * If you are using the following styling:
    .main-text h1 a:hover{ text-decoration:
   underline; }
 * This is trying to underline a hyperlink that you hover over.
 * Try removing the “a:” -it will then underline regardless if it’s a hyperlink.
 *  Thread Starter [CombatPost](https://wordpress.org/support/users/combatpost/)
 * (@combatpost)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276780)
 * Hi Arncus,
 * Thanks for the reply, but that doesn’t work either!!
 * When I use `<?php the_author_posts_link(); ?>` in the same way, it underlines
   on hover. Is there a way to auto link that title?
 * Like `<?php the_title_posts_link(); ?>`
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276783)
 * Your HTML is not nested properly if you are using that code.
 *     ```
       <h1>
         <a href="<?php esc_url( the_permalink() ); ?>" rel="bookmark">
           <?php the_title(); ?>
         </a>
       <h1>
       ```
   
 * Should be the code if you want the CSS to take effect right. The reason it is
   not working is because you have the `h1` tag inside of the anchor ( `a` ) tag.
   That would mean your CSS would be something like:
 *     ```
       a:hover h1 {
           /* CSS goes here */
       }
       ```
   
 *  Thread Starter [CombatPost](https://wordpress.org/support/users/combatpost/)
 * (@combatpost)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276785)
 * Thanks for your reply Jose.
 * I have tried it both ways, inside and outside the anchor tag, and changed the
   CSS accordingly but no change.
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276789)
 * Have you tried clearing your cache? I was able to apply the rule:
 *     ```
       .main-text a:hover {
           color: blue;
           text-decoration: underline;
       }
       ```
   
 *  Thread Starter [CombatPost](https://wordpress.org/support/users/combatpost/)
 * (@combatpost)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276791)
 * Hi Jose,
 * Yeah I managed to fix it with the info you provided.
 * I now have h1 outside the anchor tags and have the CSS as h1 a{. . . and that
   works perfectly.
 * Any help on another problem, though? When I call for the title, I call first 
   for the featured headline as follows.
 *     ```
       <?php if(get_post_meta($post->ID, "mvp_featured_headline", true)): ?>
   
       				<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php echo get_post_meta($post->ID, "mvp_featured_headline", true); ?></a></h2>
   
       				<?php else: ?>
       the title. . .
       ```
   
 * The CSS is NOT working for when the article is using a featured headline, but
   is working when using the title.
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276794)
 * Unfortunately you will have to seek CSS help from a dedicated CSS forum. Most
   volunteers may/may not be able to further help you with it. All I can really 
   tell you is that odds are your CSS selectors may not be right. 🙁
 *  Thread Starter [CombatPost](https://wordpress.org/support/users/combatpost/)
 * (@combatpost)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276795)
 * Ok Jose, thanks alot for the help 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘CSS not working for permalink’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 3 participants
 * Last reply from: [CombatPost](https://wordpress.org/support/users/combatpost/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/css-not-working-for-permalink/#post-4276795)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
