I am exporting my map with qgis2web and I would like to export the opacity of my layers as well. It does not work, somebody has an idea?
Opacity does work on qgis2web but only at the feature level of opacity, it seems. Here's a qgis2web preview (left) and a QGIS main canvas (right) side-by-side:
The opacity on the yellow features comes from the "Fill Color" of the "Simple Fill" styling opacity (note you can see through to the checkerboard under the yellow), and shows through on the web map:
But the blue polygon has opacity from the overall opacity of the layer, set at the top level of the layer styling dialog:
but that opacity does not show up on the web map. I tried OpenLayers and Leaflet versions, both did the same.
However the Mapbox GL JS web map did... the exact opposite! Transparent blue and opaque yellow!
It might be worth a check on the Qgis2web developer site to see if this is a known issue and reporting it if not. I also checked the preview on Firefox and the same things happened. Opacity in QGIS can come from so many places - the layer level, the feature, the styling, the layer group - that it is hard for qgis2web to find all the places where it could be specified. And that's even before considering complicated styles like graduated fills and polygon starbursts.
So if you can set the transparency at the fill symbol level like my yellow layers, that should work for you.