I am a newbie to editing javascript.

I want to set the Max width and height of the popup that QGIS2Web generates with a Leaflet map (I have quite a lot of text in the attributes and will need a scroll bar).

Could someone help me out with the code that I would need to insert in my index.html file?

2 Answers 2


Add the following CSS somewhere (either between <style> tags in your main map HTML file within the <head>, or better in a CSS file):

.leaflet-popup-content {
    max-width: 200px;
    height: 200px;
    overflow-y: scroll;

enter image description here

Not fully tested - hope it's broadly correct.


For even more specificity, edit the qgis2web.css file in the RESOURCES sub-directory created by the qgis2web plugin, as shown below. See the changes to height, width and overflow parameters.

enter image description here

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.