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

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

        
    

for the above html code I am using the fol

5条回答
  •  无人及你
    2020-12-19 13:51

    The underline is caused by the text decoration on the a. So just apply text-decoration:none to the a.

    Edit: there is currently no CSS-only way to apply a style to "any a that has an img as its child". CSS does not have selectors for that. So you'll either have to make these as unique by giving them classes (or other attributes) and apply the CSS to those classes, or run some script that tests for imgs in as and gives those as the desired style.

提交回复
热议问题