Forum Discussion

amke321's avatar
amke321
Copper Contributor
Oct 23, 2024
Solved

JSON Attribute iconName Creates Pseudo class of CSS (::before) which Repeats the Icon

SharePoint List form, JSON added in Header: { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "attributes": { "c...
  • renatocamara's avatar
    Oct 23, 2024

    amke321 
    To resolve the issue of the ::before pseudo-class automatically being added by the server in SharePoint, you cannot directly control or remove the ::before pseudo-element via JSON formatting.

    However, you can override its behavior by:
    1. Using Custom CSS: Apply custom CSS that overrides the ::before content:
    .css-333::before {
    content: none !important;
    }

    2. Inject Custom CSS: You can inject the CSS using a SharePoint Framework (SPFx) extension or a modern script editor web part.


    This method prevents the duplicate icon rendering while keeping the iconName behavior intact.

Resources