I use mPDF to convert html file to pdf file, almost fine but !important
property does not work. The code is below:
CSS:
td .style1 {border-left:2px #000000 solid !important;}
td .style2 {border-left:none;}
HTML:
<table>
<tr>
<td class="style1 style2">Something here</td>
</tr>
</table>
The result is border-left of td
tag disappear. I think the reason is style2
bellow style1
and mPDF not know !important
property. How can I fix this problem?
Note: html and css code is automatically generated, so I cannot delete style2
because css class name can be changed every time it is generated.
Note 2: The border disappear in pdf file, which generated by mPDF. The border is fine with html in browser.
You cannot have two rules of the same type requesting two different things. Therefore the only logical thing to do next if you cannot remove style 2 is to create an inline style like this when it is generated:
This will effectively override the style-sheet entirely and use what you told it to use here.