4

Since QGIS 3.32, HTML formatting in composer text boxes works differently and code snippets like this example that used to display a linear gradient no longer work :

<html> <head> <style type="text/css">
body { background: -webkit-linear-gradient(right,#ffffff,#3ad3fd,#8ecd10,#ffea01,#fe003b,#8901ff);  }
* { color: white}
</style></head>
<body>
This is an HTML gradient!
</body> </html>

I'm told from this issue that:

since 3.32, users have to rely on HTML item (instead of an HTML-enabled label item) when wanting to rely on <style> tags

... which seems to refer to this change but the changelog doesn't point to any github commit and not being an html guru, I couldn't find the difference between an "HTML item" and an "HTML-enabled label item". Googling it seemingly yields no related result so I'm stuck in my research.

Is there a way to fix this HTML snippet to make it work in QGIS 3.32?

2
  • here is the code commit, including the test project/data
    – JGH
    Commented Nov 9, 2023 at 20:26
  • Thank you! The test file helped a lot. I posted an answer. Commented Nov 10, 2023 at 9:19

1 Answer 1

3

In the composer, we now have to use the html box tool instead of the regular label box:

enter image description here

With this type of box the code works:

enter image description here

Thanks to @JGH for helping me unlock this mystery.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.