- Products -


Software


NEWS


Special



- Knowledge -


Category × Tag



- Like -

公開
作成日:2022/3/15
更新日:2022/3/15

CSSで一括文字挿入を行うbefore.after要素

・疑似要素を使うことで、セレクタで選択した要素の前後に文字や画像を一括で追加することが可能。

実装例


・td内のaタグでhref属性内に&p=があったら、★を表示という例。

td a[href*="&q="]::before {
        content: "★";
        color: #f5a500;
        font-size: 16px;
}


参考


https://gray-code.com/html_css/setting-pseudo-element-on-before-and-after-for-element/

https://csshtml.work/cssurl/#ahrefURL-3


Category



Tag




関連記事


{{tmp.name}}

{{article.category}} {{article.title}}