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

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

        
    

for the above html code I am using the fol

5条回答
  •  自闭症患者
    2020-12-19 13:49

    You could use CSS Descendent Selector

    So, in your case:

    a > img { text-decoration: none; }
    

    However, the above rule will add the style to the image (that is the descendent) and not the parent, so it might not be what you're looking for. Unfortunately, there is no CSS rule that applies styling to the parent in case of a descendent.

提交回复
热议问题