I'm generating a pdf from the following html...
<span class="welcome-header"></span>
<img class="welcome-logo" src="my/image.png" />
and the my css file...
.welcome-header {
background-color: #d4d7db;
height: 40px;
display: block;
}
.welcome-logo {
width: 50%;
}
The welcome-header
class styling gets applied as I'd expect- but the welcome-logo
class doesn't. The logo (which is too big for the page) doesn't change size. Frustratingly, if I use inline styling like so...
<img style="width: 50%" src="my/image.png" />
The styling is applied correctly. I can't find anything in the documentation about classes not working on <img>
tags, what am I missing?
Edit: using Weasyprint 0.21 if it's relevant.
I've upgraded from Weasyprint 0.21 to 0.36 (latest) and the problem has gone away. I'd looked in the changelogs prior to this question but couldn't see anything related to img tags. If someone wants to respond to the question with the problem and the fix I'll switch the accepted answer to that.