remove link underline from image only if the anchor tag contains an img

后端 未结 5 2132
灰色年华
灰色年华 2020-12-19 13:28

        
    

for the above html code I am using the fol

5条回答
  •  半阙折子戏
    2020-12-19 13:50

    If you can't set a class for each link that has an image inside of it, you prolly must use javascript. You could simply add something like this:

    jQuery(document).ready(function($) {
        var a_with_img = $('a').children()
        $(a_with_img).parent().css('text-decoration', 'none');
    });
    

    This should work, however it's never a good idea to target all the 'a' selectors with js, it's pretty heavy on the load. Might cause slowdowns to your overall pageload.

提交回复
热议问题