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.
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(); ?>
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 */
}
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.
Have you tried clearing your cache? I was able to apply the rule:
.main-text a:hover {
color: blue;
text-decoration: underline;
}
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.
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. 🙁
Ok Jose, thanks alot for the help 🙂