1

I'm trying to find some extensive documentation on styling the map tips box when hovering over features. I'm using CSS school to do basic styling but some (like background) don't seem to do anything for me.

I'm using the following:

<style>
    h1 {color:red; font-size: 20px; text-align: center; width: 300px;}
    h3 {color:black;font-size: 12px; font-style: bold; font-family: verdana; border-width: 2px; border-left-style: solid;} 
    p {color:black; font-size: 12px; font-family: verdana;}
    body {background-color: grey;}
</style>

So all of that works, except for the background. Among correcting my mistake, is there any QGIS specific css documentation other than https://nathanw.net/2012/08/05/html-map-tips-in-qgis/ which is not at lot to go off.

1

You would need to override the background color, i.e. declaring it as !important. Interestingly, the <body></body> tags are not required. There is probably another hidden container around the maptip box as forcing the background value leaves a white border that I couldn't get rid of playing with padding/margin of the body itself. Maybe pure CSS tricks can be used to get rid of it.

<style> 
body {background-color: grey !important; } 
h1 {color:red; font-size: 20px; text-align: center; width: 300px;}
</style>

<h1>Test</h1>
Test2
  • I can live with the white border, although it would be interesting to hear if anybody has further comments. Thanks JGH – James B May 12 '17 at 11:46

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.