Jump to content

Changing link colour of H1 tag


otester

Recommended Posts

I wanted to make my header text into a link (so a user can get back to the main page easily).

 

I've noticed that H1 tags don't behave the same way as normal div tags when it comes to dealing with links.

 

The H1 link just won't respond (stays default blue link colour):

 

HTML:

 

<div id="header_container_menu_item_2"><a href="http://www.punch101.com"><h1 id="title_link">x</h1></a></div>

 

 

CSS:

 

a.title_link:link { text-decoration: none; color: #F90; }
a.title_link:visited { text-decoration: none; color: #F90; }
        a.title_link:hover { text-decoration: none; color: #F90; }
a.title_link:active { text-decoration: none; color: #F90; }

 

Any help at all would be greatly appreciated?

Link to comment
Share on other sites

Take the 'id="link_title"' from the <h1> tag and pop it in the <a href="#"> tag, so it looks like this...

 

<div id="header_container_menu_item_2"><a href="http://www.punch101.com" class="title_link"><h1>x</h1></a></div>

 

Works a treat, thanks a lot! :D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.