otester Posted August 10, 2010 Share Posted August 10, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/210373-changing-link-colour-of-h1-tag/ Share on other sites More sharing options...
lostprophetpunk Posted August 10, 2010 Share Posted August 10, 2010 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> Quote Link to comment https://forums.phpfreaks.com/topic/210373-changing-link-colour-of-h1-tag/#findComment-1097784 Share on other sites More sharing options...
otester Posted August 10, 2010 Author Share Posted August 10, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/210373-changing-link-colour-of-h1-tag/#findComment-1097786 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.