Allow custom styling for consent banner
See original GitHub issueRight now the consent banner is styled one-size-fits-all. While we try to keep it low-impact for most designs, this surely hurts adoption in cases where a unified UX is important for operators.
While it’s technically trivial to allow operators to inject custom CSS into the iframe element that displays the banner, this also comes with some pitfalls and requirements:
- Operators should not be able to alter the content in the banner (i.e. change wording to be misleading or hide certain elements)
- The default a11y and privacy standards must be preserved in any case
Approach: allowing operators to define custom CSS per account
Semantic classes are applied to the markup that displays the consent banner. Operators can now add custom CSS for each account which the server
will add (in addition to the predefined styles) to each vault
response. In order to prevent operators from creating a misleading consent banner the following sanitzation rules are applied to the CSS before saving:
- no pseudo content
- no hiding of elements
- no opacity rules
Pros
- Allows operators to apply fine grained styling that matches virtually any site design
- Technically simple to implement
Cons
- Sanitizing CSS will help, but it will not close all loopholes for malicious use ever (then again, forking Offen is a lot easier and gives you all options)
- Does not offer a middle ground for non-technically savvy users that don’t want to / cannot write CSS but still want to customize their banner’s appearace
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How to add custom styles to cookie consent banner
This is exactly why we have introduced a custom CSS styling option. Go to your CookieScript user account > Settings > Design, where...
Read more >How to Add Custom CSS to Your Cookie Consent Banner
CookieYes enables you to change the appearace of your cookie consent banner by adding custom styles to the banner using the custom CSS...
Read more >Customize GDPR cookie banner using CSS - WebToffee
GDPR cookie consent plugin allows you to customize the cookie banner in different ways. Following are some of the sample code snippets by ......
Read more >Customizing the Banner Template - CookiePro Community
On the Cookie Consent menu, select Templates. The Templates screen appears. Click on the name of the template you want to customize. The...
Read more >Changing the CSS of cookie consent banner in Secure Privacy
Customize your cookie consent banners with CSS using this guide · Navigate to Banners Cookie Banner Add custom CSS. · Paste your CSS...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@m90 I love how you implemented this feature, what with the preview function and everything - well done! The documentation was more than sufficient for me personally.
Before
After
Edit: The subtle yellow tint is from LightBulb running while I was taking the screenshots.
Your requirements as a user are super helpful and all we need. Thank you.