1

I've got a pop-up for a layer with more than one attribute for the layer in question. I would like to make the first attribute in the popup appear with a bold font and a different color. Anyone have any idea?

screenshot

1

As far as I know there is no straight forward way to do this in the plugin. A workaround is to open the .html file in an editor, and add <b> tag or any other formatting tag for the field that you want to highlight, like so: enter image description here

I've added a <b> tag for the top row

var popupContent = '<table>\
                <tr>\
                    <th scope="row">Imagery Date</th>\
                    <td><b>' + (feature.properties['Imagery Date'] !== null ? Autolinker.link(String(feature.properties['Imagery Date'])) : '') + '</b></td>\
                </tr>\
                <tr>\
                    <th scope="row">Area (sq. meters)</th>\
                    <td>' + (feature.properties['Area (sq. meters)'] !== null ? Autolinker.link(String(feature.properties['Area (sq. meters)'])) : '') + '</td>\
                </tr>\
            </table>';

It is displayed so:

enter image description here

2

Open the file css/qgis2web.css from your exported map in a text editor, and add the following to the end:

.leaflet-popup-content tr:first-of-type {
    font-weight: bold;
    color: red;
}

Obviously change the colour to suit your needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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