html - Adequate CSS selector 1 nested element up -
using css selectors, to, on click of link, put box shadow around div 1 element up.
<!doctype html> <html> <body> <div class="container"> <div id="selected_div"> <a><p id="click"></p></a> </div> </div> </body> </html>
i not know selectors use. please enlighten me.
considering want action based upon click, it's better use javascript anyway. css has no parent selector , cannot detect click. here jquery solution:
$("document").ready(function() { $("#selected_div a").click(function() { $(this).parent().css("box-shadow", "2px 2px 3px #fff"); } }
remember include jquery library.
Comments
Post a Comment