<style> .divClass {background: green} .link {color: yellow} </style> <div class="divClass"> <a class="link" href="#" onclick="alert(this.parentNode.className)">link</a> </div>