phpmady Posted December 5, 2010 Share Posted December 5, 2010 Hi, <span class="other_items"> <p> <a href="">asdfdsafdsaf dsafsdaf sdafds</a> </p> </span> how to write the css for above content, i tried this below css style but it fails for anchor tag inside the paragraph Note: i dont want to write <a href="" class="other_items">asdfdsafdsaf dsafsdaf sdafds</a> in the above. <style type="text/css"> p a.other_items:link {text-decoration: none; color:red;} p a.other_items:visited {text-decoration: none; color:red;} p a.other_items:active {text-decoration: none; color:red;} p a.other_items:hover {text-decoration: none; color:red;} </style> Please give me some solution Thanks guys, Quote Link to comment https://forums.phpfreaks.com/topic/220726-anchor-tag/ Share on other sites More sharing options...
The Letter E Posted December 5, 2010 Share Posted December 5, 2010 <span class="other_items"> <p> <a href="">asdfdsafdsaf dsafsdaf sdafds</a> </p> </span> This should work: <style type="text/css"> .other_items p a:link {text-decoration: none; color:red;} .other_items p a:visited {text-decoration: none; color:red;} .other_items p a:active {text-decoration: none; color:red;} .other_items p a:hover {text-decoration: none; color:red;} </style> It was a basic syntax error. Hope this helped. E Quote Link to comment https://forums.phpfreaks.com/topic/220726-anchor-tag/#findComment-1143269 Share on other sites More sharing options...
haku Posted December 6, 2010 Share Posted December 6, 2010 The Letter E was mostly correct, with one tiny little problem. It should be this: <style type="text/css"> .other_items p a:link {text-decoration: none; color:red;} .other_items p a:visited {text-decoration: none; color:red;} .other_items p a:hover {text-decoration: none; color:red;} .other_items p a:active {text-decoration: none; color:red;} </style> The order of pseudo selectors needs to be link -> visited -> hover -> active. This is easy to remember with LoVeHAte: LinkVisitedHoverActive. If you don't do it in this order, you will find strange things happening in some browsers, and it can be really difficult to debug. Quote Link to comment https://forums.phpfreaks.com/topic/220726-anchor-tag/#findComment-1143464 Share on other sites More sharing options...
The Letter E Posted December 6, 2010 Share Posted December 6, 2010 The Letter E was mostly correct, with one tiny little problem. It should be this: <style type="text/css"> .other_items p a:link {text-decoration: none; color:red;} .other_items p a:visited {text-decoration: none; color:red;} .other_items p a:hover {text-decoration: none; color:red;} .other_items p a:active {text-decoration: none; color:red;} </style> The order of pseudo selectors needs to be link -> visited -> hover -> active. This is easy to remember with LoVeHAte: LinkVisitedHoverActive. If you don't do it in this order, you will find strange things happening in some browsers, and it can be really difficult to debug. Thanks for the correction. I was unaware of that order. Quote Link to comment https://forums.phpfreaks.com/topic/220726-anchor-tag/#findComment-1143510 Share on other sites More sharing options...
phpmady Posted December 6, 2010 Author Share Posted December 6, 2010 <span class="other_items"> <p> <a href="">asdfdsafdsaf dsafsdaf sdafds</a> </p> </span> This should work: <style type="text/css"> .other_items p a:link {text-decoration: none; color:red;} .other_items p a:visited {text-decoration: none; color:red;} .other_items p a:active {text-decoration: none; color:red;} .other_items p a:hover {text-decoration: none; color:red;} </style> It was a basic syntax error. Hope this helped. E Thanks Letter E, really embarassing for me, Quote Link to comment https://forums.phpfreaks.com/topic/220726-anchor-tag/#findComment-1143518 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.