首页 > 解决方案 > CSS 选择具有特定字体的所有文本

问题描述

有没有办法选择具有某种字体的所有元素?我试过了:

[font-family*=Menlo]{
    font-family: OpenDyslexicMono;
}

标签: css

解决方案


I think this global selector will help to do that


  `* { /* this solution best and along the side worst also help you select all the elements */
       font-family: OpenDyslexicMono;
    }
` 

    html, body { /* this allows the children to inherit this style */
       font-family: OpenDyslexicMono;
    }
    
    body * { /* assigns this style to every tag inside of your body tag */
        font-family: OpenDyslexicMono;
    }
    
    p, span, a, etc { /* you decided what tags would most likely contain text to apply that style */
        font-family: OpenDyslexicMono;
    }

这是我第一次回答。让我知道这是否对您有帮助。
如果我犯了任何错误,请告诉我
谢谢


推荐阅读