Luca Reghellin
Luca Reghellin

Reputation: 8113

How to remove block elements margins in mpdf?

I noticed that block elements (ex. div) have some kind of margins by default, and it seems I cannot reset them via css. So how to? does anyone know?

Upvotes: 0

Views: 830

Answers (2)

Luca Reghellin
Luca Reghellin

Reputation: 8113

Ok, further investigation took me to the following findings:

Basically, you cannot use other than really simple/direct selectors. No nested selectors are allowed (like .class p, or ul li), so:

  • think ahead and structure your document in a really simple manner so you don't have to use nested selectors or something more complicated. For example, do not use nested lists (ul li ul)

  • write your css all with ultra simple direct selectors (one element or one class)

  • then you can reset all the margins and paddings of block elements, if/when/where needed.

Upvotes: 1

Raashid Din Dar
Raashid Din Dar

Reputation: 306

Define your margin. E.g; you have class named as me. So browser is using own agent stylesheet. What you have to do is to apply t margin to same class. Remember your CSS will override that. So your code will look like .me {margin:0}. Then the margin will not be applied. Hope this helps

Upvotes: 0

Related Questions